File size: 1,250 Bytes
83a59ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script setup lang="ts">
import { useDisplay } from 'vuetify'
import { mdiCheck, mdiInformation } from '@mdi/js'

const { lgAndUp } = useDisplay()
const notificationsStore = useNotificationsStore()

const notificationActive = computed({
  get: () => notificationsStore.notification.active,
  set: () => notificationsStore.disableNotification(),
})
</script>

<template>
  <v-snackbar
    v-model="notificationActive"
    variant="tonal"
    :color="notificationsStore.notification.type"
    :timeout="notificationsStore.notification.timeout"
    :z-index="10000"
  >
    <v-icon
      v-if="notificationsStore.notification.type === 'success'"
      :color="notificationsStore.notification.type"
      :icon="mdiCheck"
    />
    <v-icon
      v-if="notificationsStore.notification.type === 'info'"
      :color="notificationsStore.notification.type"
      :icon="mdiInformation"
    />
    {{ notificationsStore.notification.message }}
    <template #actions>
      <v-btn
        v-if="lgAndUp"
        :color="notificationsStore.notification.type"
        variant="text"
        @click="notificationsStore.disableNotification()"
      >
        <span class="font-weight-bold">Close</span>
      </v-btn>
    </template>
  </v-snackbar>
</template>