diff --git a/frontend/app.vue b/frontend/app.vue index 7cd4dbe..dd43ce5 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -14,7 +14,7 @@ import { VueQueryDevtools } from "@tanstack/vue-query-devtools"; diff --git a/frontend/assets/css/animations.css b/frontend/assets/css/animations.css new file mode 100644 index 0000000..a906403 --- /dev/null +++ b/frontend/assets/css/animations.css @@ -0,0 +1,104 @@ +/* + Zoom animation +*/ + +.zoom-leave-active, +.zoom-enter-active { + transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; +} + +.zoom-enter-to, +.zoom-leave-from { + opacity: 1; + transform: scale(1) translateY(0px); +} + +.zoom-enter-from, +.zoom-leave-to { + opacity: 0; + transform: scale(0.95) translateY(15px); +} + +/* + Fade animation +*/ + +.fade-leave-active, +.fade-enter-active { + transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; +} + +.fade-enter-to, +.fade-leave-from { + opacity: 1; +} + +.fade-enter-from, +.fade-leave-to { + opacity: 0; +} + +/* + FadeDown animation +*/ + +.fade-down-leave-active, +.fade-down-enter-active { + transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; +} + +.fade-down-enter-to, +.fade-down-leave-from { + opacity: 1; + transform: translateY(0px) scale(1); +} + +.fade-down-enter-from, +.fade-down-leave-to { + opacity: 0; + transform: translateY(10px) scale(0.95); +} + +/* + FadeRightToLeft animation +*/ + +.fade-right-to-left-leave-active, +.fade-right-to-left-enter-active { + transform-origin: bottom right; + transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; +} + +.fade-right-to-left-enter-to, +.fade-right-to-left-leave-from { + opacity: 1; + transform: translateX(0px) scale(1); +} + +.fade-right-to-left-enter-from, +.fade-right-to-left-leave-to { + opacity: 0; + transform: translateX(30px) scale(0.95); +} + +/* + FadeRight animation +*/ + +.fade-right-leave-active, +.fade-right-enter-active { + transform-origin: right; + transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; +} + +.fade-right-enter-to, +.fade-right-leave-from { + opacity: 1; + transform: translateX(0); +} + +.fade-right-enter-from, +.fade-right-leave-to { + opacity: 0; + transform: translateX(100%); +} diff --git a/frontend/assets/css/tailwind.css b/frontend/assets/css/tailwind.css index 1ce8cae..40c03b1 100644 --- a/frontend/assets/css/tailwind.css +++ b/frontend/assets/css/tailwind.css @@ -1,5 +1,6 @@ @import "tailwindcss"; +@import "./animations.css"; @import "./other.utils.css"; @import "./typo.utils.css"; @import "./button.comp.css"; @@ -166,38 +167,42 @@ @keyframes contentShow { from { opacity: 0; - transform: translate(-50%, -48%) scale(0.96); + transform: scale(0.96); } to { opacity: 1; - transform: translate(-50%, -50%) scale(1); + transform: scale(1); } } @keyframes toastHide { - from { opacity: 1 } - to { opacity: 0 } + from { + opacity: 1; + } + to { + opacity: 0; + } } @keyframes toastSlideIn { from { opacity: 0; - transform: translateX(calc(100% + var(--viewport-padding))) + transform: translateX(calc(100% + var(--viewport-padding))); } to { opacity: 1; - transform: translateX(0) + transform: translateX(0); } } @keyframes toastSlideOut { from { opacity: 1; - transform: translateX(var(--reka-toast-swipe-end-x)) + transform: translateX(var(--reka-toast-swipe-end-x)); } to { opacity: 0; - transform: translateX(calc(100% + var(--viewport-padding))) + transform: translateX(calc(100% + var(--viewport-padding))); } } } diff --git a/frontend/components/global/CategoryCard.vue b/frontend/components/global/CategoryCard.vue index f62fa67..33be331 100644 --- a/frontend/components/global/CategoryCard.vue +++ b/frontend/components/global/CategoryCard.vue @@ -2,31 +2,47 @@ // types +import { useImageColor } from "~/composables/useImageColor"; + type Props = { + id: number, category: string; count: number; description: string; picture: string; + darkLayer?: boolean; } // props -defineProps(); +const props = defineProps(); +const { id } = toRefs(props); + +// state + +const { colorObject } = useImageColor(`#category-image-${id.value}`);