diff options
Diffstat (limited to 'src/lib/Notification/NotificationsProvider.svelte')
| -rw-r--r-- | src/lib/Notification/NotificationsProvider.svelte | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/Notification/NotificationsProvider.svelte b/src/lib/Notification/NotificationsProvider.svelte new file mode 100644 index 00000000..964317e9 --- /dev/null +++ b/src/lib/Notification/NotificationsProvider.svelte @@ -0,0 +1,31 @@ +<script lang="ts"> + import { notifications } from './store'; + import EventNotification from './Notification.svelte'; + + export let zIndex = 5000; + + const handleRemove = (id: string) => { + notifications.remove(id); + }; +</script> + +<div class="notifications-container" style="z-index: {zIndex};"> + {#each $notifications as notification (notification.id)} + <EventNotification {notification} onRemove={() => handleRemove(notification.id)} /> + {/each} +</div> + +<slot /> + +<style> + .notifications-container { + position: fixed; + top: 0; + right: 0; + pointer-events: none; + } + + .notifications-container :global(#notification-container) { + pointer-events: auto; + } +</style> |