coolify/apps/ui/src/lib/components/Toasts.svelte

28 lines
718 B
Svelte
Raw Normal View History

2022-08-09 15:28:26 +00:00
<script lang="ts">
import { fade } from 'svelte/transition';
import Toast from './Toast.svelte';
2022-08-16 11:58:37 +00:00
import { dismissToast, pauseToast, resumeToast, toasts } from '$lib/store';
2022-08-09 15:28:26 +00:00
</script>
{#if $toasts}
<section>
2022-08-12 14:09:52 +00:00
<article class="toast toast-top toast-end rounded-none" role="alert" transition:fade>
2022-08-09 15:28:26 +00:00
{#each $toasts as toast (toast.id)}
2022-08-12 14:09:52 +00:00
<Toast
type={toast.type}
on:resume={() => resumeToast(toast.id)}
2022-08-16 11:58:37 +00:00
on:pause={() => pauseToast(toast.id)}
on:click={() => dismissToast(toast.id)}>{@html toast.message}</Toast
2022-08-12 14:09:52 +00:00
>
2022-08-09 15:28:26 +00:00
{/each}
</article>
</section>
{/if}
<style lang="postcss">
section {
2022-08-12 14:09:52 +00:00
@apply fixed top-0 left-0 right-0 w-full flex flex-col mt-4 justify-center z-[1000];
2022-08-09 15:28:26 +00:00
}
</style>