Browse Source

adds smooth removal of notifications using animate:flip

master
Keviin Åberg Kultalahti 6 years ago
parent
commit
67afb1678f
  1. 2
      packages/builder/src/components/common/Notification/NotificationDisplay.svelte
  2. 2
      packages/client/src/components/NotificationDisplay.svelte

2
packages/builder/src/components/common/Notification/NotificationDisplay.svelte

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

2
packages/client/src/components/NotificationDisplay.svelte

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

Loading…
Cancel
Save