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

<script lang="ts">
  import {defineComponent, computed} from "@vue/composition-api";
  import {useContext} from "@nuxtjs/composition-api";

  export default defineComponent({
    setup() {
      const {store} = useContext()

      const alerts = computed(() => {
        return store.state.page.alerts
      })
      return {
        alerts
      }
    }
  })
</script>

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

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