diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index ae18f00..a646aba 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -1,7 +1,8 @@ -import { ReactNode } from "react"; +import { ReactNode, useId } from "react"; import { createPortal } from "react-dom"; import { GrClose } from "react-icons/gr"; +import { motion } from "framer-motion"; import styles from "./modal.module.scss"; interface ModalProps { @@ -22,12 +23,25 @@ export default function Modal({ noHeader = false, padding = "1em 1.5em", }: ModalProps) { + const modalId = useId(); const handleWrapperClick = (event) => event.target.classList?.[0] === styles["modal-wrapper"] && close(); return createPortal( -
-
+ + {!noHeader && (

{title}

@@ -42,8 +56,8 @@ export default function Modal({
)}
{children}
-
-
, + + , document.body ); } diff --git a/src/components/Modal/modal.module.scss b/src/components/Modal/modal.module.scss index 92f6b2e..cfa2310 100644 --- a/src/components/Modal/modal.module.scss +++ b/src/components/Modal/modal.module.scss @@ -1,5 +1,4 @@ @import "styles/colors.scss"; -@import "styles/keyframes.scss"; .modal-wrapper { z-index: 9999; @@ -13,7 +12,6 @@ display: flex; align-items: center; flex-direction: column; - animation: opacityin 0.3s both; } .modal-container { @@ -25,7 +23,6 @@ align-items: center; justify-content: center; flex-direction: column; - animation: fadeintop 0.3s both; box-shadow: 0 0 1em 0px rgba($black, 0.25); } diff --git a/src/components/SideMenu/Categories/CategoryItem.tsx b/src/components/SideMenu/Categories/CategoryItem.tsx index 1e400ac..9bf9256 100644 --- a/src/components/SideMenu/Categories/CategoryItem.tsx +++ b/src/components/SideMenu/Categories/CategoryItem.tsx @@ -38,8 +38,8 @@ export default function CategoryItem({ transition={{ type: "spring", stiffness: 260, - damping: 20, - delay: index * 0.025, + damping: 25, + delay: index * 0.02, duration: 200, }} className={className} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 9c51a95..f7fced5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -9,7 +9,7 @@ import SearchModal from "components/SearchModal/SearchModal"; import SideMenu from "components/SideMenu/SideMenu"; import * as Keys from "constants/keys"; -import { motion } from "framer-motion"; +import { AnimatePresence, motion } from "framer-motion"; import { Category, Link, SearchItem } from "types"; import { prisma } from "utils/back"; import { BuildCategory } from "utils/front"; @@ -174,15 +174,17 @@ function Home(props: HomeProps) { openSearchModal={modal.open} /> - {modal.isShowing && ( - - )} + + {modal.isShowing && ( + + )} + ); }