Fix linting,

Make toasts fit content rather than having the same width
This commit is contained in:
kylejwatson 2020-07-04 16:54:49 +01:00
parent 0b988e72b9
commit a26690b5be
2 changed files with 4 additions and 3 deletions

View File

@ -4,10 +4,12 @@
transform: translate(-50%, 0); transform: translate(-50%, 0);
bottom: 50px; bottom: 50px;
z-index: 1; z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
} }
.toast { .toast {
display: flex;
padding: 10px; padding: 10px;
margin: 5px; margin: 5px;
overflow-y: auto; overflow-y: auto;

View File

@ -28,12 +28,11 @@ export default Vue.extend({
setTimeout(this.clear, 300) setTimeout(this.clear, 300)
} }
toast.isOpen = false toast.isOpen = false
}, },
open: function (message, action, time) { open: function (message, action, time) {
const toast = { message: message, action: action || (() => { }), isOpen: false, timeout: null } const toast = { message: message, action: action || (() => { }), isOpen: false, timeout: null }
toast.timeout = setTimeout(this.close, time || 3000, toast) toast.timeout = setTimeout(this.close, time || 3000, toast)
setImmediate(() => toast.isOpen = true) setImmediate(() => { toast.isOpen = true })
if (this.toasts.length > 4) { if (this.toasts.length > 4) {
for (let i = this.toasts.length - 1; i >= 0; i--) { for (let i = this.toasts.length - 1; i >= 0; i--) {
if (!this.toasts[i].isOpen) { if (!this.toasts[i].isOpen) {