Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/Notifications.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:global(.toasts) > .toast {
position: relative;
margin: 10px;
min-width: 40vw;
min-width: var(--width);
position: relative;
animation: animate-in 350ms forwards;
color: #fff;
Expand Down Expand Up @@ -75,15 +75,15 @@
transform: scale(1.15) translateY(20px);
}
100% {
width: 40vw;
width: var(--width);
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes shrink {
0% {
width: 40vw;
width: var(--width);
}
100% {
width: 0;
Expand All @@ -104,7 +104,15 @@
default: '#aaaaaa'
}
export let timeout = 3000
export let options = {
timeout: 3000,
width: '40vw'
}
onMount(() => {
const toasts = document.querySelector('.toasts');
toasts.style.setProperty('--width', options.width);
});
let count = 0
let toasts = [ ]
Expand Down Expand Up @@ -135,7 +143,7 @@
id: count,
msg,
background,
timeout: to || timeout,
timeout: to || options.timeout,
width: '100%'
}, ...toasts];
count = count + 1
Expand Down