Skip to content

Commit f687238

Browse files
authored
Merge pull request #147 from mosu-dev/feat#146
Feature#146 Apply 페이지에 STEP Navigation 컴포넌트 구현
2 parents 8fa5a8b + b99ec56 commit f687238

7 files changed

Lines changed: 87 additions & 17 deletions

File tree

mosu-admin/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { RouterProvider } from "react-router";
2-
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
32
import { router } from "@/routes";
43
import ErrorBoundary from "@/common/ui/ErrorBoundary";
54
import { QueryProvider } from "@/common/lib/queryProvider";
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { ChevronRight } from "lucide-react";
2+
3+
import { cn } from "@/shared/lib/utils";
4+
5+
const applySteps = ["apply-step1", "apply-step2", "apply-payment"] as const;
6+
7+
export const ApplyStepNavigator = ({ step }: { step: string }) => {
8+
const stepIndex = applySteps.indexOf(step as (typeof applySteps)[number]) + 1;
9+
10+
return (
11+
<nav>
12+
<ul className="flex h-[48px] w-full items-center justify-between text-sm font-semibold">
13+
<ApplyStepNavigatorItem
14+
index={1}
15+
label="응시 정보"
16+
active={stepIndex >= 1}
17+
/>
18+
19+
<ApplyStepNavigatorDecorator active={stepIndex >= 2} />
20+
<ApplyStepNavigatorItem
21+
index={2}
22+
label="개인 정보"
23+
active={stepIndex >= 2}
24+
/>
25+
26+
<ApplyStepNavigatorDecorator active={stepIndex >= 3} />
27+
<ApplyStepNavigatorItem
28+
index={3}
29+
label="결제"
30+
active={stepIndex >= 3}
31+
/>
32+
</ul>
33+
</nav>
34+
);
35+
};
36+
37+
const ApplyStepNavigatorItem = ({
38+
index,
39+
label,
40+
active,
41+
}: {
42+
index: number;
43+
label: string;
44+
active: boolean;
45+
}) => {
46+
return (
47+
<li className="flex items-center gap-2">
48+
<div
49+
className={cn(
50+
"flex h-6 w-6 items-center justify-center rounded-full text-xs",
51+
active
52+
? "bg-[#0080FF] text-white"
53+
: "bg-[#F5F5F5] text-[#909090]",
54+
)}
55+
>
56+
{index}
57+
</div>
58+
<span className={cn(active ? "text-[#0080FF]" : "text-[#909090]")}>
59+
{label}
60+
</span>
61+
</li>
62+
);
63+
};
64+
65+
const ApplyStepNavigatorDecorator = ({ active }: { active: boolean }) => {
66+
return (
67+
<ChevronRight
68+
size={16}
69+
className={cn(active ? "text-[#0080FF]" : "text-[#909090]")}
70+
/>
71+
);
72+
};

mosu-app/src/pages/apply/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { applySteps } from "@/features/apply/constants/steps";
22
import { ApplyContextProvider } from "@/features/apply/contexts/ApplyContext";
3+
import { ApplyStepNavigator } from "@/features/apply/ui/ApplyStepNavigator";
34

45
import { ApplyPayment } from "@/widgets/apply/ApplyPayment";
56
import { ApplyPaymentFail } from "@/widgets/apply/ApplyPaymentFail";
@@ -13,8 +14,16 @@ export default function ApplyPage() {
1314
const { Funnel, Step, useStep } = useFunnel(applySteps);
1415
const { step, setStep } = useStep();
1516

17+
const shouldShowNavigator = applySteps.slice(0, -2).includes(step as (typeof applySteps)[number]);
18+
1619
return (
1720
<div>
21+
{shouldShowNavigator && (
22+
<header className="mb-18">
23+
<h1 className="my-20 text-center text-[2.5rem] font-bold">모의수능 신청</h1>
24+
<ApplyStepNavigator step={step} />
25+
</header>
26+
)}
1827
<Funnel>
1928
<Step name="apply-step1">
2029
<ApplyStep1 useStep={{ step: step as (typeof applySteps)[number], setStep }} />
@@ -23,7 +32,7 @@ export default function ApplyPage() {
2332
<ApplyStep2 useStep={{ step: step as (typeof applySteps)[number], setStep }} />
2433
</Step>
2534
<Step name="apply-payment">
26-
<ApplyPayment />
35+
<ApplyPayment useStep={{ step: step as (typeof applySteps)[number], setStep }} />
2736
</Step>
2837
<Step name="apply-payment-success">
2938
<ApplyPaymentSuccess />

mosu-app/src/pages/auth/kakao/callback.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useKakaoAuth } from "@/features/auth-signin/hooks/useKakaoAuth";
2+
import { useRouter } from "next/router";
23

34
export default function KakaoCallbackPage() {
5+
const router = useRouter();
46
const { error, isLoading } = useKakaoAuth({
57
redirectTo: "/",
68
});
@@ -16,7 +18,7 @@ export default function KakaoCallbackPage() {
1618
잠시 후 다시 시도해주세요.
1719
</p>
1820
<button
19-
onClick={() => window.location.href = "/auth/member/signin"}
21+
onClick={() => router.push("/auth/member/signin")}
2022
className="mt-5 px-5 py-2 bg-blue-500 text-white border-none rounded cursor-pointer hover:bg-blue-600 transition-colors"
2123
>
2224
로그인 페이지로 이동

mosu-app/src/widgets/apply/ApplyPayment.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ export const ApplyPayment = ({
2121

2222
return (
2323
<div>
24-
<header>
25-
<h1 className="my-20 text-center text-[2.5rem] font-bold">모의수능 신청</h1>
26-
</header>
27-
2824
<PaymentConfirmCard
2925
location="대치"
3026
date="2025-11-03"

mosu-app/src/widgets/apply/ApplyStep1.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ export const ApplyStep1 = ({
3232

3333
return (
3434
<div>
35-
<header>
36-
<h1 className="my-20 text-center text-[2.5rem] font-bold">모의수능 신청</h1>
37-
</header>
38-
3935
<InfoCard title="응시료 안내" content={EXAM_FEE_INFO} />
4036

4137
<section>
@@ -85,8 +81,8 @@ export const ApplyStep1 = ({
8581
placeholder="고사장"
8682
options={
8783
EXAM_SCHOOL_NAME[
88-
state.schools[index]
89-
.area as keyof typeof EXAM_SCHOOL_NAME
84+
state.schools[index]
85+
.area as keyof typeof EXAM_SCHOOL_NAME
9086
]
9187
}
9288
onValueChange={(value) => {

mosu-app/src/widgets/apply/ApplyStep2.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ export const ApplyStep2 = ({
2626
}) => {
2727
return (
2828
<div>
29-
<header>
30-
<h1 className="my-20 text-center text-[2.5rem] font-bold">모의수능 신청</h1>
31-
</header>
32-
3329
<div className="flex justify-between gap-4">
3430
<ProfileImageFileUpload />
3531
<div className="flex flex-1 flex-col justify-between">

0 commit comments

Comments
 (0)