<!--
Container principal pour l'affichage d'une ou plusieurs alertes
-->

<template>
  <main class="alertContainer">
    <LayoutAlertContent
      v-for="(alert, key) in alerts"
      :key="key"
      class="alertContent"
      :alert="alert"
    />
  </main>
</template>

<script setup lang="ts">
import { Alert } from '~/types/interfaces'
import {usePageStore} from "~/stores/page";
import {ComputedRef} from "@vue/reactivity";

const pageStore = usePageStore()

const alerts: ComputedRef<Array<Alert>> = computed(() => {
  return pageStore.$state.alerts
})

</script>

<style scoped>
  .alertContainer {
    position: fixed;
    bottom: 0;
    right: 20px;
    z-index: 1000;
  }

  .alertContainer > .alertContent {
    position: relative;
    margin-bottom: 10px;
  }
</style>
