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

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

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

const pageStore = usePageStore()

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

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

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