-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c2d542
commit 92e1503
Showing
4 changed files
with
66 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use client'; | ||
|
||
import { useRouter, useSearchParams } from 'next/navigation'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { BackButton, HeaderBar } from '@/components/molecules'; | ||
import { Step1 } from '@/features/setting/components'; | ||
import { Step2 } from '@/features/setting/components'; | ||
import { Step3 } from '@/features/setting/components'; | ||
|
||
export default function Page() { | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const [step, setStep] = useState(1); | ||
|
||
useEffect(() => { | ||
const queryStep = searchParams.get('step'); | ||
if (queryStep) { | ||
setStep(Number(queryStep)); | ||
} | ||
}, [searchParams]); | ||
|
||
const handleListItemClick = () => { | ||
setStep(2); | ||
router.push('?step=2'); | ||
}; | ||
|
||
const getStepComponent = (step: number) => { | ||
switch (step) { | ||
case 1: | ||
return <Step1 onClickListItem={handleListItemClick} />; | ||
case 2: | ||
return <Step2 />; | ||
case 3: | ||
return <Step3 />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<HeaderBar> | ||
<HeaderBar.LeftContent> | ||
<BackButton /> | ||
</HeaderBar.LeftContent> | ||
</HeaderBar> | ||
{getStepComponent(step)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,16 @@ | ||
'use client'; | ||
import dynamic from 'next/dynamic'; | ||
import React, { Suspense } from 'react'; | ||
|
||
import { useRouter, useSearchParams } from 'next/navigation'; | ||
import { useEffect, useState } from 'react'; | ||
import { LoadingArea } from '@/components/atoms'; | ||
|
||
import { BackButton, HeaderBar } from '@/components/molecules'; | ||
import Step1 from '@/features/setting/components/organisms/step-1'; | ||
import Step2 from '@/features/setting/components/organisms/step-2'; | ||
import Step3 from '@/features/setting/components/organisms/step-3'; | ||
const StepComponent = dynamic(() => import('./index'), { | ||
suspense: true, | ||
}); | ||
|
||
export default function Page() { | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const [step, setStep] = useState(1); | ||
|
||
useEffect(() => { | ||
const queryStep = searchParams.get('step'); | ||
if (queryStep) { | ||
setStep(Number(queryStep)); | ||
} | ||
}, [searchParams]); | ||
|
||
const handleListItemClick = () => { | ||
setStep(2); | ||
router.push('?step=2'); | ||
}; | ||
|
||
const getStepComponent = (step: number) => { | ||
switch (step) { | ||
case 1: | ||
return <Step1 onListItemClick={handleListItemClick} />; | ||
case 2: | ||
return <Step2 />; | ||
case 3: | ||
return <Step3 />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<HeaderBar> | ||
<HeaderBar.LeftContent> | ||
<BackButton /> | ||
</HeaderBar.LeftContent> | ||
</HeaderBar> | ||
{getStepComponent(step)} | ||
</div> | ||
<Suspense fallback={<LoadingArea />}> | ||
<StepComponent /> | ||
</Suspense> | ||
); | ||
} |