Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: 모달 아래서 위로 뜨는 애니메이션 추가 (#246) #247

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@
justify-content: center;
background: rgb(0 0 0 / 40%);
transition: visibility 0.2s ease-out;
visibility: hidden;
display: none;
display: flex;

@include xs {
align-items: flex-end;
}

&.open {
visibility: visible;
display: flex;
}

.modalBox {
color: color('gray09');
background-color: color('white');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ReactElement, useRef } from 'react';

import { Button } from '@dnd-academy/ui';
import clsx from 'clsx';
import { AnimatePresence, motion } from 'motion/react';
import { useOnClickOutside, useScrollLock } from 'usehooks-ts';

import GlobalPortal from '@/components/global/GlobalPortal';
Expand All @@ -25,26 +26,42 @@ function ModalContentsBase({ children: child, title, size = 'medium' } : Props)

return (
<GlobalPortal>
{open && (
<div className={clsx(styles.modalWrapper, open && styles.open)}>
<div
ref={modalContentsRef}
role="dialog"
className={clsx(styles.modalBox, styles[size])}
<AnimatePresence>
{open && (
<motion.div
className={clsx(styles.modalWrapper)}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
<div className={styles.header}>
<h1 className={styles.title}>{title}</h1>
<Button
type="button"
className={styles.closeButton}
onClick={() => toggle(false)}
icon={<CloseIcon />}
/>
</div>
{child}
</div>
</div>
)}
<motion.div
ref={modalContentsRef}
role="dialog"
className={clsx(styles.modalBox, styles[size])}
initial={{ y: 50, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: 50, opacity: 0 }}
transition={{
type: 'spring',
stiffness: 300,
damping: 30,
duration: 0.3,
}}
>
<div className={styles.header}>
<h1 className={styles.title}>{title}</h1>
<Button
type="button"
className={styles.closeButton}
onClick={() => toggle(false)}
icon={<CloseIcon />}
/>
</div>
{child}
</motion.div>
</motion.div>
)}
</AnimatePresence>
</GlobalPortal>
);
}
Expand Down