adds smooth removal of notifications using animate:flip

This commit is contained in:
Keviin Åberg Kultalahti 2021-01-22 13:05:52 +01:00
parent 91e88d2025
commit 67afb1678f
2 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<script>
import { notificationStore } from "builderStore/store/notifications"
import { flip } from 'svelte/animate';
import { fly } from "svelte/transition"
export let themes = {
@ -26,6 +27,7 @@
<div class="notifications">
{#each $notificationStore.notifications as notification (notification.id)}
<div
animate:flip
class="toast"
style="background: {themes[notification.type]};"
transition:fly={{ y: -30 }}>

View File

@ -1,4 +1,5 @@
<script>
import { flip } from 'svelte/animate';
import { fly } from "svelte/transition"
import { getContext } from "svelte"
const notifications = getContext("notifications")
@ -15,6 +16,7 @@
<div class="notifications">
{#each $notifications as notification (notification.id)}
<div
animate:flip
class="toast"
style="background: {themes[notification.type]};"
transition:fly={{ y: -30 }}>