Files
music-v2/app/ui/ToastContainer.vue

78 lines
1.2 KiB
Vue

<script setup lang="ts">
const { toasts, remove } = useToast()
</script>
<template>
<div class="toast-container">
<TransitionGroup name="toast">
<div
v-for="toast in toasts"
:key="toast.id"
class="toast"
:class="[toast.type]"
@click="remove(toast.id)"
>
{{ toast.message }}
</div>
</TransitionGroup>
</div>
</template>
<style lang="scss" scoped>
@use "@/styles/variables" as *;
.toast-container {
position: fixed;
bottom: 0;
right: 0;
z-index: 100;
padding: 20px;
display: flex;
flex-direction: column;
gap: 10px;
}
.toast {
background-color: $color-background;
border: 1px solid $color-border;
border-radius: $border-radius-standard;
padding: 10px 16px;
min-width: 200px;
cursor: pointer;
transition: transform 0.2s ease, opacity 0.2s ease;
}
.toast-enter-from {
opacity: 0;
transform: translateX(50px);
}
.toast-enter-active {
transition: all 0.3s ease-out;
}
.toast-enter-to {
opacity: 1;
transform: translateX(0);
}
.toast-leave-from {
opacity: 1;
transform: translateX(0);
}
.toast-leave-active {
transition: all 0.3s ease-out;
}
.toast-leave-to {
opacity: 0;
transform: translateX(50px);
}
</style>