Skip to content

Commit

Permalink
refactor:#5 기본경로를 signup/birthday-gender 로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
dalzzy committed Jan 5, 2025
1 parent 9a609e0 commit d4f589c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
23 changes: 10 additions & 13 deletions src/pages/SignUpPage/SignUpLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,24 @@ import Header from '@/components/common/Header/Header';
import ProgressBar from '@/components/SignUp/ProgressBar';
import { Outlet, useLocation } from 'react-router-dom';

const stepPaths = [
'/signup/birthday-gender',
'/signup/phone-number',
'/signup/mbti',
'/signup/nickname',
'/signup/student-id',
'/signup/profile-image',
];

const SignupLayout: React.FC = () => {
const location = useLocation();

const stepPaths = [
'/signup/birthday-gender',
'/signup/phone-number',
'/signup/mbti',
'/signup/nickname',
'/signup/student-id',
'/signup/profile-image',
];

const currentStepIndex = stepPaths.indexOf(location.pathname);
const progress = ((currentStepIndex + 1) / stepPaths.length) * 100;

return (
<div>
<Header
showBackButton={currentStepIndex > 0}
onBackClick={() => window.history.back()}
/>
<Header showBackButton={true} onBackClick={() => window.history.back()} />

<ProgressBar progress={progress} />

Expand Down
33 changes: 8 additions & 25 deletions src/routes/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBrowserRouter } from 'react-router-dom';
import { createBrowserRouter, Navigate } from 'react-router-dom';
import Home from '@/pages/Home';
import Intro from '@/pages/SignUpPage/Intro';
import PolicyDetails from '@/pages/SignUpPage/PolicyDetails';
Expand All @@ -19,30 +19,13 @@ const router = createBrowserRouter([
path: '/signup',
element: <SignupLayout />,
children: [
{
path: 'birthday-gender',
element: <BirthdayGenderStep />,
},
{
path: 'phone-number',
element: <PhoneNumStep />,
},
{
path: 'mbti',
element: <MbtiStep />,
},
{
path: 'nickname',
element: <NicknameStep />,
},
{
path: 'student-id',
element: <StudentIdStep />,
},
{
path: 'profile-img',
element: <ProfileImgStep />,
},
{ index: true, element: <Navigate to="/signup/birthday-gender" /> },
{ path: 'birthday-gender', element: <BirthdayGenderStep /> },
{ path: 'phone-number', element: <PhoneNumStep /> },
{ path: 'mbti', element: <MbtiStep /> },
{ path: 'nickname', element: <NicknameStep /> },
{ path: 'student-id', element: <StudentIdStep /> },
{ path: 'profile-img', element: <ProfileImgStep /> },
],
},
{
Expand Down

0 comments on commit d4f589c

Please sign in to comment.