Skip to content

Commit c9b9870

Browse files
committed
Modal 컴포넌트 신규 추가 및 스타일 적용
1 parent adb27aa commit c9b9870

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

src/shared/ui/Modal/Modal.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Button } from '@shared/ui/Button/Button';
2+
import { modalVariants } from './Modal.variants';
3+
4+
export interface ModalProps {
5+
title: string;
6+
subtitle?: string;
7+
onCancel: () => void;
8+
onConfirm: () => void;
9+
}
10+
11+
export const Modal = ({ title, subtitle, onCancel, onConfirm }: ModalProps) => {
12+
const { overlay, container, textGroup, buttonGroup, buttonWrapper } = modalVariants();
13+
14+
return (
15+
<div className={overlay()}>
16+
<div className={container()}>
17+
<div className={textGroup()}>
18+
<p className="typo-body-2 text-black">{title}</p>
19+
{subtitle && <p className="typo-caption-2 truncate text-black">{subtitle}</p>}
20+
</div>
21+
22+
<div className={buttonGroup()}>
23+
<div className={buttonWrapper()}>
24+
<Button variant="outline" size="auto" className="w-full" onClick={onCancel}>
25+
취소
26+
</Button>
27+
</div>
28+
29+
<div className={buttonWrapper()}>
30+
<Button variant="fill" size="auto" className="w-full" onClick={onConfirm}>
31+
삭제
32+
</Button>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
);
38+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { tv } from 'tailwind-variants';
2+
3+
export const modalVariants = tv({
4+
slots: {
5+
overlay: 'fixed inset-0 z-50 flex items-center justify-center bg-black/40',
6+
7+
container:
8+
'w-[347px] h-[167px] rounded-[var(--radius-l)] bg-[var(--color-green-500)] px-[32px] py-[24px] flex flex-col justify-between',
9+
10+
textGroup: 'flex flex-col gap-[var(--spacing-xxs)]',
11+
12+
buttonGroup: 'flex gap-3',
13+
14+
buttonWrapper: 'flex-1',
15+
},
16+
});

src/shared/ui/Modal/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { Modal } from './Modal';
2+
export type { ModalProps } from './Modal';

0 commit comments

Comments
 (0)