summaryrefslogtreecommitdiff
path: root/src-migrate/common/components/elements/Modal.tsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-25 17:27:32 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-25 17:27:32 +0700
commitcf6da809621b4ebe8c9acedb035b689e7e1b60b1 (patch)
tree5b5a80f7b13066bf3a2342242d6e4fce4b25b5b2 /src-migrate/common/components/elements/Modal.tsx
parent90710579ba1c12060877f6ec2d26103f9c31058d (diff)
Update register page
Diffstat (limited to 'src-migrate/common/components/elements/Modal.tsx')
-rw-r--r--src-migrate/common/components/elements/Modal.tsx18
1 files changed, 11 insertions, 7 deletions
diff --git a/src-migrate/common/components/elements/Modal.tsx b/src-migrate/common/components/elements/Modal.tsx
index ad1fe51b..91421251 100644
--- a/src-migrate/common/components/elements/Modal.tsx
+++ b/src-migrate/common/components/elements/Modal.tsx
@@ -11,7 +11,8 @@ type Props = {
active: boolean
title?: string
close?: () => void,
- className?: string
+ className?: string,
+ mode?: "mobile" | "desktop"
}
const Modal = ({
@@ -19,11 +20,14 @@ const Modal = ({
active = false,
title,
close,
- className
+ className,
+ mode
}: Props) => {
const { width } = useWindowSize()
const [rendered, setRendered] = useState<boolean>(false)
+ mode = mode || width >= 768 ? "desktop" : "mobile"
+
useEffect(() => {
setRendered(true)
}, [])
@@ -31,16 +35,16 @@ const Modal = ({
const modalClassNames = clsxm(
"fixed bg-white max-h-[80vh] overflow-auto p-4 pt-0 z-[60] border-gray_r-6",
{
- "left-1/2 -translate-x-1/2 translate-y-1/2 bottom-1/2 md:w-1/4 lg:w-1/3 border rounded-xl": width >= 768,
- "left-0 w-full border-t bottom-0 rounded-t-xl": width < 768
+ "left-1/2 -translate-x-1/2 translate-y-1/2 bottom-1/2 w-11/12 md:w-1/4 lg:w-1/3 border rounded-xl": mode === 'desktop',
+ "left-0 w-full border-t bottom-0 rounded-t-xl": mode === 'mobile'
},
className
)
const variant = {
- initial: { bottom: width >= 768 ? '45%' : '-100%', opacity: 0 },
- animate: { bottom: width >= 768 ? '50%' : 0, opacity: 1 },
- exit: { bottom: width >= 768 ? '55%' : '-100%', opacity: 0 },
+ initial: { bottom: mode === 'desktop' ? '45%' : '-100%', opacity: 0 },
+ animate: { bottom: mode === 'desktop' ? '50%' : 0, opacity: 1 },
+ exit: { bottom: mode === 'desktop' ? '55%' : '-100%', opacity: 0 },
transition: { ease: 'linear', duration: 0.25 }
}