Files
mealie/frontend/app/components/Layout/LayoutParts/TheSnackbar.vue
miah 09c2a0b2ad feat: Shopping list / Swipe to check off (#7118)
Co-authored-by: Michael Genson <genson.michael@gmail.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
2026-05-06 10:31:33 -05:00

73 lines
1.7 KiB
Vue

<template>
<div class="text-center">
<v-snackbar
v-model="toastAlert.open"
location="top"
:color="toastAlert.color"
:timeout="toastAlert.timeout ?? 2000"
>
<v-icon
v-if="icon"
dark
start
:icon="icon"
/>
{{ toastAlert.title }}
{{ toastAlert.text }}
<template #actions>
<v-btn
variant="text"
@click="() => {
toastAlert.action?.onClick();
toastAlert.open = false
}"
>
{{ toastAlert.action?.message ?? $t('general.close') }}
</v-btn>
</template>
</v-snackbar>
<v-snackbar
v-model="toastLoading.open"
content-class="py-2"
density="compact"
location="bottom"
:timeout="-1"
:color="toastLoading.color"
>
<div
class="d-flex flex-column align-center justify-start"
@click="toastLoading.open = false"
>
<div class="mb-2 mt-0 text-subtitle-1 text-center">
{{ toastLoading.text }}
</div>
<v-progress-linear
indeterminate
color="white-darken-2"
/>
</div>
</v-snackbar>
</div>
</template>
<script setup lang="ts">
import { useNuxtApp } from "#app";
import { toastAlert, toastLoading } from "~/composables/use-toast";
const { $globals } = useNuxtApp();
const icon = computed(() => {
switch (toastAlert.color) {
case "error":
return $globals.icons.alertOutline;
case "success":
return $globals.icons.checkBold;
case "info":
return $globals.icons.informationOutline;
default:
return $globals.icons.alertOutline;
}
});
</script>