<script lang="ts">
import EventNotification from "./Notification.svelte";
import { notifications } from "./store";

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>
