<!--
Container principal pour l'affichage d'une ou plusieurs alertes
-->
<!-- eslint-disable vue/valid-v-for -->

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

<script setup lang="ts">
import { computed } from 'vue'
import type { Alert } from '~/types/interfaces'
import { usePageStore } from '~/stores/page'

const pageStore = usePageStore()

// Using alerts in the template v-for directive
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const alerts = computed<Array<Alert>>(() => pageStore.alerts)
</script>

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

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