Skip to content

Commit c655ab2

Browse files
committed
#2 [FEAT] 온보딩 화면 UI
1 parent 7a8d835 commit c655ab2

File tree

2 files changed

+79
-2
lines changed

2 files changed

+79
-2
lines changed

src/pages/HomePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const HomePage = () => {
66
return (
77
<div className="flex h-full flex-col items-center justify-center gap-8">
88
<img src={logo} alt="Vite logo" className="h-40" />
9-
<h1 className="text-6xl text-[#0D2D84]">Snowgent</h1>
9+
<h1 className="text-6xl font-bold text-[#0D2D84]">Snowgent</h1>
1010
<button
1111
onClick={() => navigate('/onboarding')}
1212
className="cursor-pointer rounded-lg bg-blue-50 px-10 py-5 text-xl font-semibold text-[#0D2D84] hover:bg-blue-100"
Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,82 @@
1+
import { useState } from 'react';
2+
import Navigation from '../../components/Navigation';
3+
import FormButton from '../../components/onboarding/FormButton';
4+
import { useNavigate } from 'react-router-dom';
5+
import TextInput from '../../components/onboarding/TextInput';
6+
import PriceInput from '../../components/onboarding/PriceInput';
7+
import SingleSelect from '../../components/onboarding/SingleSelect';
8+
import MultiSelect from '../../components/onboarding/MultiSelect';
9+
110
const Onboarding = () => {
2-
return <div>Onboarding</div>;
11+
const navigate = useNavigate();
12+
const [currentStep, setCurrentStep] = useState(1);
13+
const totalSteps = 5;
14+
15+
const handlePrev = () => {
16+
if (currentStep > 1) {
17+
setCurrentStep(currentStep - 1);
18+
}
19+
};
20+
21+
const handleNext = () => {
22+
if (currentStep < totalSteps) {
23+
setCurrentStep(currentStep + 1);
24+
}
25+
};
26+
27+
const handleComplete = () => {
28+
navigate('/chat');
29+
};
30+
31+
const renderStepContent = () => {
32+
switch (currentStep) {
33+
case 1:
34+
return <SingleSelect key="step1" title="업종을" />;
35+
case 2:
36+
return <TextInput key="step2" title="업체명을" placeholder="" />;
37+
case 3:
38+
return <TextInput key="step3" title="위치(시군구)를" placeholder="" />;
39+
case 4:
40+
return <PriceInput key="step4" title="평균 월매출" placeholder="숫자" />;
41+
case 5:
42+
return <PriceInput key="step5" title="목표 월매출" placeholder="숫자" />;
43+
default:
44+
return <MultiSelect key="default" title="원하는 타겟층" />;
45+
}
46+
};
47+
48+
return (
49+
<div className="flex h-full flex-col">
50+
<Navigation />
51+
<div className="flex flex-1 flex-col p-5">
52+
<div className="mb-6">
53+
<div className="mb-2 flex justify-between text-sm text-gray-600">
54+
<span>단계 {currentStep}</span>
55+
<span>
56+
{currentStep} / {totalSteps}
57+
</span>
58+
</div>
59+
<div className="h-2 w-full rounded-full bg-gray-200">
60+
<div
61+
className="h-2 rounded-full bg-blue-500 transition-all duration-300"
62+
style={{ width: `${(currentStep / totalSteps) * 100}%` }}
63+
/>
64+
</div>
65+
</div>
66+
67+
<div className="flex-1 overflow-y-auto">{renderStepContent()}</div>
68+
69+
<div className="mt-6 flex gap-3">
70+
{currentStep > 1 && <FormButton type="prev" onClick={handlePrev} />}
71+
{currentStep === totalSteps ? (
72+
<FormButton type="submit" onClick={handleComplete} />
73+
) : (
74+
<FormButton type="next" onClick={handleNext} />
75+
)}
76+
</div>
77+
</div>
78+
</div>
79+
);
380
};
481

582
export default Onboarding;

0 commit comments

Comments
 (0)