Made slimSidebar move toast position as well

This commit is contained in:
RemixDev 2020-10-30 10:54:46 +01:00
parent 01204b71fb
commit 362d1a1368
3 changed files with 11 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -724,6 +724,10 @@ export default {
set(wantSlimSidebar) {
this.slimSidebar = wantSlimSidebar
document.getElementById('sidebar').classList.toggle('slim', wantSlimSidebar)
// Moves all toast messages when the option changes
Array.from(document.getElementsByClassName('toastify')).forEach((toast)=>{
toast.style.transform = `translate(${wantSlimSidebar ? '3rem' : '14rem'}, 0)`;
})
localStorage.setItem('slimSidebar', wantSlimSidebar)
}
},

View File

@ -6,10 +6,7 @@ import { socket } from '@/utils/socket'
const sharedOptions = {
gravity: 'bottom',
position: 'left',
offset: {
x: '14rem'
}
position: 'left'
}
let toastsWithId = {}
@ -87,6 +84,9 @@ export const toast = function(msg, icon = null, dismiss = true, id = null) {
delete toastsWithId[id]
}
}
},
offset: {
x: 'true' === localStorage.getItem('slimSidebar') ? '3rem': '14rem'
}
}).showToast()
if (id) {