-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
20 changed files
with
139 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ProfileFormIntroPage } from 'src/pages/form/intro/ProfileFormIntroPage'; | ||
import { useState } from 'react'; | ||
import { SwitchCase } from 'src/shared/ui/SwitchCase'; | ||
import { MyProfilePage } from 'src/pages/form/my_profile/MyProfilePage'; | ||
import { IdealPartnerIntroPage } from 'src/pages/form/intro/IdealPartnerIntroPage'; | ||
import { IdealPartnerPage } from 'src/pages/form/ideal_partner/IdealPartnerPage'; | ||
import { FormConfirmPage } from 'src/pages/form/confirm/FormConfirmPage'; | ||
import { UploadLoadingPage } from 'src/pages/form/complete/UploadLoadingPage'; | ||
import { CompletePage } from 'src/pages/form/complete/CompletePage'; | ||
import { useProfileFirstName } from 'src/entities/profile/lib/useProfileFirstName'; | ||
import { Shortcut } from 'src/processes/shortcut/Shortcut'; | ||
import styles from 'src/app/styles/form.module.css'; | ||
|
||
const MAX_STEP_COUNT = 7; | ||
|
||
export default function ProfileFormPage() { | ||
const [step, setStep] = useState(0); | ||
|
||
const increase = () => setStep((prev) => (prev + 1 < MAX_STEP_COUNT ? prev + 1 : prev)); | ||
|
||
const name = useProfileFirstName(); | ||
|
||
const showShortcut = [1, 3, 4].includes(step); | ||
|
||
return ( | ||
<div className={styles.Wrapper}> | ||
<SwitchCase | ||
value={step} | ||
caseBy={{ | ||
0: <ProfileFormIntroPage onClickNextStep={increase} />, | ||
1: <MyProfilePage onClickNextStep={increase} />, | ||
2: <IdealPartnerIntroPage name={name} onClickNextStep={increase} />, | ||
3: <IdealPartnerPage onClickNextStep={increase} />, | ||
4: <FormConfirmPage onClickNextStep={increase} />, | ||
5: <UploadLoadingPage name={name} onComplete={increase} />, | ||
6: <CompletePage />, | ||
}} | ||
/> | ||
{showShortcut && <Shortcut right={'20px'} bottom={'100px'} />} | ||
</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,9 +1,13 @@ | ||
import { ProfileFormIntroPage } from 'src/pages/form/intro/ProfileFormIntroPage'; | ||
import { Outlet } from '@remix-run/react'; | ||
import { MyProfileProvider } from 'src/entities/profile/model/myProfileStore'; | ||
import { IdealPartnerProvider } from 'src/entities/ideal_partner/model/idealPartnerStore'; | ||
|
||
export default function ProfileFormPage() { | ||
export default function ProfileFormLayout() { | ||
return ( | ||
<> | ||
<ProfileFormIntroPage /> | ||
</> | ||
<MyProfileProvider> | ||
<IdealPartnerProvider> | ||
<Outlet /> | ||
</IdealPartnerProvider> | ||
</MyProfileProvider> | ||
); | ||
} |
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,6 @@ | ||
.Wrapper { | ||
height: 100%; | ||
padding: 0 20px 40px; | ||
overflow: hidden; | ||
position: relative; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.Wrapper { | ||
padding: 0 24px 24px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
|
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
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 |
---|---|---|
|
@@ -41,5 +41,5 @@ | |
|
||
.Footer { | ||
margin-top: auto; | ||
padding: 15px 0; | ||
padding-top: 24px; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.Wrapper { | ||
height: 100%; | ||
width: 100%; | ||
padding: 0 20px 8px; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
|
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.Wrapper { | ||
height: 100%; | ||
width: 100%; | ||
padding: 0 20px 8px; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
|
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 |
---|---|---|
|
@@ -40,5 +40,5 @@ | |
|
||
.Footer { | ||
margin-top: auto; | ||
padding: 15px 0; | ||
padding-top: 24px; | ||
} |
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
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,18 @@ | ||
type Props<Case extends string | number> = { | ||
caseBy: Partial<Record<Case, JSX.Element | null>>; | ||
value: Case; | ||
defaultComponent?: JSX.Element | null; | ||
}; | ||
|
||
// https://github.com/toss/slash/blob/main/packages/react/react/src/components/SwitchCase/SwitchCase.tsx | ||
export const SwitchCase = <Case extends string | number>({ | ||
value, | ||
caseBy, | ||
defaultComponent: defaultComponent = null, | ||
}: Props<Case>) => { | ||
if (value == null) { | ||
return defaultComponent; | ||
} | ||
|
||
return caseBy[value] ?? defaultComponent; | ||
}; |