diff --git a/apps/scandic-web/components/Modal/index.tsx b/apps/scandic-web/components/Modal/index.tsx index cd4a9be32..ca25338fd 100644 --- a/apps/scandic-web/components/Modal/index.tsx +++ b/apps/scandic-web/components/Modal/index.tsx @@ -1,7 +1,7 @@ "use client" import { cx } from "class-variance-authority" -import { motion } from "framer-motion" +import { AnimatePresence, motion } from "framer-motion" import { type PropsWithChildren, useEffect, useState } from "react" import { Dialog, @@ -154,22 +154,28 @@ export default function Modal({ } }, [isOpen]) + const shouldRender = isOpen || animation !== AnimationStateEnum.unmounted + if (!trigger) { return ( - - {children} - + + {shouldRender && ( + + {children} + + )} + ) } @@ -182,17 +188,21 @@ export default function Modal({ } > {trigger} - - {children} - + + {shouldRender && ( + + {children} + + )} + ) }