Skip to content

Commit 624d27f

Browse files
committed
fix: button variant 추가, 방석 있는 이미지로 변경
1 parent 1d2f7f7 commit 624d27f

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

public/empty-character.png

2.34 KB
Loading

src/components/Button.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,30 @@ import { cn } from "@/utils/cn";
44

55
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
66
asChild?: boolean;
7+
variant?: "black" | "white";
78
}
89

910
export default function Button({
1011
className,
1112
disabled,
1213
children,
1314
asChild = false,
15+
variant = "black",
1416
...props
1517
}: ButtonProps) {
1618
const Component = asChild ? Slot.Slot : "button";
1719

1820
return (
1921
<Component
2022
className={cn(
21-
"w-fit px-9 py-4 rounded-[32px] transition-colors",
23+
"w-fit px-9 py-4 rounded-[32px] transition-colors t-p-14-sb",
2224
"inline-flex items-center justify-center gap-[10px]",
2325
"shadow-[2px_2px_16px_0_rgba(0,0,0,0.4)]",
2426
{
25-
"bg-neutral-800 text-neutral-100 active:bg-neutral-900": !disabled,
27+
"bg-neutral-800 text-neutral-100 active:bg-neutral-900":
28+
!disabled && variant === "black",
29+
"bg-neutral-100 text-neutral-800 active:bg-neutral-300 active:shadow-[2px_2px_8px_0_rgba(0,0,0,0.4)]":
30+
!disabled && variant === "white",
2631
"bg-neutral-400 text-neutral-500 cursor-not-allowed": disabled,
2732
},
2833
className

src/routes/mission/$missionId/-components/MissionNotTriedFailed.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export default function MissionNotTriedFailed({
3838
</div>
3939

4040
<div className="flex justify-center gap-2 px-[30px] pb-6">
41-
<Button onClick={onRetry}>재도전</Button>
41+
<Button variant="white" onClick={onRetry}>
42+
다시 도전
43+
</Button>
4244
</div>
4345
</>
4446
);

src/routes/mission/$missionId/-components/MissionNotTriedReviewing.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ export default function MissionNotTriedReviewing({
4444
</div>
4545

4646
<div className="flex justify-center gap-2 pt-4 pb-6">
47-
<Button onClick={onFailed}>실패</Button>
4847
<Button onClick={onRetry}>재촬영</Button>
49-
<Button onClick={onSuccess}>성공</Button>
48+
<Button variant="white" onClick={onFailed}>
49+
실패
50+
</Button>
51+
<Button variant="white" onClick={onSuccess}>
52+
성공
53+
</Button>
5054
</div>
5155
</>
5256
);

src/routes/mission/$missionId/-components/MissionResultView.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,9 @@ export default function MissionResultView({
150150
</Button>
151151
)}
152152
{onRetry && (
153-
<button
154-
type="button"
155-
className="t-p-14-sb bg-neutral-100 rounded-[32px] px-9 py-4 shadow-[2px_2px_16px_0_rgba(0,0,0,0.4)]"
156-
onClick={onRetry}
157-
>
153+
<Button variant="white" onClick={onRetry}>
158154
다시 도전
159-
</button>
155+
</Button>
160156
)}
161157
</div>
162158
</>

src/routes/mission/-components/MissionEmpty.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Button from "@/components/Button";
2+
13
const STATUS_LABELS = {
24
all: "더 이상 해결할",
35
success: "성공한",
@@ -19,24 +21,19 @@ export default function MissionEmpty({
1921
alt="Mission Empty"
2022
className="w-[120px] h-[128px]"
2123
/>
22-
<div className="w-[100px] h-[20px] rounded-[50%] bg-neutral-400 mt-[-10px] z-[-1]" />
2324
<div className="flex flex-col items-center gap-2 mt-[17px]">
2425
<span className="t-p-18-sb text-neutral-100">
2526
{STATUS_LABELS[status]} 미션이 없어요
2627
</span>
27-
<span className="t-p-14-m text-neutral-300">
28+
<span className="t-p-14-m text-neutral-300 mb-[24px]">
2829
{status === "not_tried"
2930
? "오늘의 문제를 모두 해결했어요!"
3031
: "완등하기 좋은 문제를 추천해드릴게요."}
3132
</span>
3233
</div>
33-
<button
34-
type="button"
35-
className="t-p-14-sb bg-neutral-100 rounded-[32px] px-9 py-4 shadow-[2px_2px_16px_0_rgba(0,0,0,0.4)] mt-[24px]"
36-
onClick={onClickRecommend}
37-
>
34+
<Button variant="white" onClick={onClickRecommend}>
3835
추천 문제 보기
39-
</button>
36+
</Button>
4037
</div>
4138
);
4239
}

0 commit comments

Comments
 (0)