From 7fce9e1dff3dfe2b17a92872125bb29f61fee23f Mon Sep 17 00:00:00 2001 From: MAZE Date: Wed, 18 Oct 2023 13:07:56 +0330 Subject: [PATCH] refactor: seperate motion variants --- src/components/buttons/unselect/unselect.tsx | 10 ++-- src/components/category/category.tsx | 8 +++- src/components/sound/like/like.tsx | 10 ++-- src/components/sounds/sounds.tsx | 10 ++-- src/lib/motion.ts | 48 ++++++++++++++++++++ 5 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 src/lib/motion.ts diff --git a/src/components/buttons/unselect/unselect.tsx b/src/components/buttons/unselect/unselect.tsx index 6f8cf8a..0a2a37e 100644 --- a/src/components/buttons/unselect/unselect.tsx +++ b/src/components/buttons/unselect/unselect.tsx @@ -16,6 +16,7 @@ import { AnimatePresence, motion } from 'framer-motion'; import { useSoundStore } from '@/store'; import { cn } from '@/helpers/styles'; +import { fade, mix, slideX } from '@/lib/motion'; import styles from './unselect.module.css'; @@ -47,14 +48,17 @@ export function UnselectButton() { const hasHistory = useSoundStore(state => !!state.history); const unselectAll = useSoundStore(state => state.unselectAll); + const variants = mix(fade(), slideX(20)); + return ( <> {(!noSelected || hasHistory) && (