From 7823dc7ff473278ef8ee401e69796c17b33da794 Mon Sep 17 00:00:00 2001 From: MAZE Date: Thu, 4 Jan 2024 19:58:16 +0330 Subject: [PATCH] style: add animation to modal --- src/components/modal/modal.tsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/modal/modal.tsx b/src/components/modal/modal.tsx index 5e26b3a..c8b2824 100644 --- a/src/components/modal/modal.tsx +++ b/src/components/modal/modal.tsx @@ -1,6 +1,8 @@ -import { AnimatePresence } from 'framer-motion'; +import { AnimatePresence, motion } from 'framer-motion'; import { IoClose } from 'react-icons/io5/index'; +import { fade, mix, slideY } from '@/lib/motion'; + import styles from './modal.module.css'; interface ModalProps { @@ -10,23 +12,38 @@ interface ModalProps { } export function Modal({ children, onClose, show }: ModalProps) { + const variants = { + modal: mix(fade(), slideY(20)), + overlay: fade(), + }; + return ( {show && ( <> -
-
+ {children} -
+
)}