Skip to content

Commit 2c3f478

Browse files
committed
[design] 팝업에 공통 component 추가, toast ui 수정
1 parent fe06d34 commit 2c3f478

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

src/app/design-system/page.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import Button from '@/shared/components/button/Button';
44
import TextButton from '@/shared/components/button/TextButton';
5-
import ConfirmPop from '@/shared/components/ModalPop/ConfirmPop';
6-
import ModalLayout from '@/shared/components/ModalPop/ModalLayout';
5+
import ConfirmPop from '@/shared/components/modalPop/ConfirmPop';
6+
import ModalLayout from '@/shared/components/modalPop/ModalLayout';
77
import { useState } from 'react';
8-
import CustomToast from '@/shared/components/toast/CustomToast';
98
import { customToast } from '@/shared/components/toast/CustomToastUtils';
109

1110
function Page() {
@@ -23,29 +22,29 @@ function Page() {
2322

2423
{/* Input */}
2524
<div className="flex flex-col gap-2 space-y-2">
26-
<h3 className="text-xl font-medium border-b pb-1">Input</h3>
25+
<h3 className="text-lg font-medium border-b pb-1">Input</h3>
2726
{/* 여기 컴포넌트 삽입 */}
2827
</div>
2928

3029
{/* checkbox */}
3130
<div className="space-y-2">
32-
<h3 className="text-xl font-medium border-b pb-1">checkbox</h3>
31+
<h3 className="text-lg font-medium border-b pb-1">checkbox</h3>
3332
{/* 여기 컴포넌트 삽입 */}
3433
</div>
3534

3635
{/* select */}
3736
<div className="space-y-2">
38-
<h3 className="text-xl font-medium border-b pb-1">select</h3>
37+
<h3 className="text-lg font-medium border-b pb-1">select</h3>
3938
{/* 여기 컴포넌트 삽입 */}
4039
</div>
4140
</div>
4241

4342
{/* Button */}
4443
<div className="space-y-3">
45-
<h2 className="text-2xl font-semibold border-b pb-1">Button</h2>
44+
<h2 className="text-2xl font-semibold pb-1">Button</h2>
4645

4746
<div className="space-y-2">
48-
<h3 className="text-xl font-medium border-b pb-1">Button</h3>
47+
<h3 className="text-lg font-medium border-b pb-1">Button</h3>
4948
<Button type="button">버튼</Button>
5049
<Button color="purple" type="button">
5150
Button
@@ -68,36 +67,36 @@ function Page() {
6867

6968
{/* popup */}
7069
<div className="space-y-3">
71-
<h2 className="text-2xl font-semibold border-b pb-1">popup</h2>
70+
<h2 className="text-2xl font-semibold pb-1">popup</h2>
7271

7372
<div className="space-y-2">
74-
<h3 className="text-xl font-medium border-b pb-1">toast</h3>
73+
<h3 className="text-lg font-medium border-b pb-1">toast</h3>
7574
<div className="flex gap-2">
7675
<button
7776
className="px-4 py-2 bg-green-300 text-black rounded"
78-
onClick={() => customToast.success('성공 메시지입니다! 멋져요')}
77+
onClick={() => customToast.success('성공 메시지')}
7978
>
8079
Success Toast
8180
</button>
8281

8382
<button
8483
className="px-4 py-2 bg-yellow-100 text-black rounded"
85-
onClick={() => customToast.info('정보 메시지입니다!')}
84+
onClick={() => customToast.info('정보 메시지')}
8685
>
8786
Info Toast
8887
</button>
8988

9089
<button
9190
className="px-4 py-2 bg-red-200 text-black rounded"
92-
onClick={() => customToast.error('오류 메시지입니다!')}
91+
onClick={() => customToast.error('오류 메시지')}
9392
>
9493
Error Toast
9594
</button>
9695
</div>
9796
</div>
9897

9998
<div className="space-y-2">
100-
<h3 className="text-xl font-medium border-b pb-1">popup</h3>
99+
<h3 className="text-lg font-medium border-b pb-1">popup</h3>
101100
{/* 모달 열기 버튼 */}
102101
<button
103102
onClick={() => setModalOpen(true)}
@@ -117,7 +116,11 @@ function Page() {
117116
onClose={() => setModalOpen(false)}
118117
title="제목"
119118
description="설명"
120-
buttons={<>{/* 여기다가 버튼 컴포넌트 넣으면 됨 */}</>}
119+
buttons={
120+
<>
121+
<Button type="button">버튼</Button>
122+
</>
123+
}
121124
>
122125
<div>모달팝업 내용</div>
123126
</ModalLayout>

src/shared/components/ModalPop/ConfirmPop.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Button from '../button/Button';
12
import ModalLayout from './ModalLayout';
23

34
interface Props {
@@ -19,8 +20,12 @@ function ConfirmPop({ ref, open, onClose, title, description, children }: Props)
1920
description={description}
2021
buttons={
2122
<>
22-
<button>취소</button>
23-
<button>확인</button>
23+
<Button type="button" size="sm">
24+
취소
25+
</Button>
26+
<Button type="button" size="sm" color="purple">
27+
확인
28+
</Button>
2429
</>
2530
}
2631
>

src/shared/components/ModalPop/ModalLayout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ function ModalLayout({
4646
<div className="fixed inset-0 bg-black/80 flex-center " onClick={onClose} aria-hidden="true">
4747
<div
4848
className={tw(
49-
'relative p-8 rounded-lg bg-bg-pop shadow-[0_4px_9px_0_rgba(255,255,255,0.25)]',
50-
size === 'sm' && 'p-5 w-[18.75rem]',
51-
size === 'md' && 'w-[31.25rem]'
49+
'relative w-[calc(100%-1.5rem)] p-8 rounded-lg bg-bg-pop shadow-[0_4px_9px_0_rgba(255,255,255,0.25)]',
50+
size === 'sm' && 'p-5 max-w-[18.75rem]',
51+
size === 'md' && 'max-w-[31.25rem]'
5252
)}
5353
ref={ref}
5454
aria-modal="true"

src/shared/components/toast/CustomToast.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function CustomToast({ type, message, onClose }: Props) {
1818
{type === 'error' && <ErrorSvg />}
1919
</div>
2020

21-
<p className="text-sm text-white">{message}</p>
21+
<p className="text-sm text-white pr-4">{message}</p>
2222
<button
2323
type="button"
2424
onClick={onClose}
2525
aria-label="toast 닫기"
26-
className="absolute top-1 right-1"
26+
className="absolute top-1 right-2"
2727
>
2828
<Close aria-hidden />
2929
</button>

0 commit comments

Comments
 (0)