transitions

This commit is contained in:
Gauthier Roebroeck 2025-06-04 11:19:13 +08:00
parent 3ef78da65b
commit dd7a01b18a
3 changed files with 48 additions and 15 deletions

View file

@ -1,5 +1,6 @@
<template>
<q-expansion-item
v-model="expanded"
icon="mdi-cog"
:label="
$formatMessage({
@ -12,12 +13,14 @@
<template #header>
<q-item-section avatar>
<q-icon name="mdi-cog">
<q-badge
v-if="unreadCount > 0"
color="info"
rounded
floating
/>
<Transition name="fab">
<q-badge
v-if="!expanded && unreadCount > 0"
color="info"
rounded
floating
/>
</Transition>
</q-icon>
</q-item-section>
<q-item-section>
@ -73,15 +76,15 @@
}}
</q-item-label>
</q-item-section>
<q-item-section
side
v-if="unreadCount > 0"
>
<q-badge
color="info"
rounded
>{{ unreadCount }}</q-badge
>
<q-item-section side>
<Transition name="fab">
<q-badge
v-if="unreadCount > 0"
color="info"
rounded
>{{ unreadCount }}</q-badge
>
</Transition>
</q-item-section>
</q-item>
@ -167,4 +170,10 @@
import { useAnnouncements } from 'colada/queries/announcements'
const { unreadCount } = useAnnouncements()
const expanded = ref<boolean>(false)
</script>
<style scoped lang="scss">
@use 'styles/transitions/fab';
</style>

View file

@ -0,0 +1,13 @@
.fab {
&-enter-active,
&-leave-active {
transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
&-enter-from,
&-leave-to {
opacity: 0;
transform: rotate(180deg) scale(0.2) skew(20deg);
filter: hue-rotate(90deg);
}
}

View file

@ -0,0 +1,11 @@
.fade {
&-enter-active,
&-leave-active {
transition: opacity 0.5s ease;
}
&-enter-from,
&-leave-to {
opacity: 0;
}
}