-
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.
feat(processes/ideal): add RequiredOptionForm
- Loading branch information
Showing
5 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/processes/ideal_partner/RequiredOptionForm/RequiredOptionForm.module.css
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,3 @@ | ||
.Container { | ||
height: 100%; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/processes/ideal_partner/RequiredOptionForm/RequiredOptionForm.stories.ts
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,13 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { RequiredOptionForm } from 'src/processes/ideal_partner/RequiredOptionForm/RequiredOptionForm'; | ||
|
||
const meta: Meta<typeof RequiredOptionForm> = { | ||
component: RequiredOptionForm, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof RequiredOptionForm>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
src/processes/ideal_partner/RequiredOptionForm/RequiredOptionForm.tsx
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,35 @@ | ||
import styles from './RequiredOptionForm.module.css'; | ||
import { useIdlePartnerStore } from 'src/entities/ideal_partner/model/idealPartnerStore'; | ||
import { CheckBox } from 'src/shared/ui/CheckBox/CheckBox'; | ||
|
||
const optionList: { label: string }[] = [ | ||
{ label: '나이' }, | ||
{ label: '키 + 선호하는 스타일' }, | ||
{ label: '지역' }, | ||
{ label: '취미' }, | ||
{ label: '종교' }, | ||
{ label: '음주 습관' }, | ||
{ label: '흡연 여부' }, | ||
]; | ||
|
||
export const RequiredOptionForm = () => { | ||
const requiredOptions = useIdlePartnerStore((state) => state.requiredOptions); | ||
const setRequiredOptions = useIdlePartnerStore((state) => state.setRequiredOptions); | ||
|
||
return ( | ||
<section className={styles.Container}> | ||
{optionList.map((option) => ( | ||
<CheckBox | ||
key={option.label} | ||
checked={requiredOptions.some((o) => o === option.label)} | ||
label={option.label} | ||
onChange={(value) => | ||
value | ||
? setRequiredOptions([...requiredOptions, option.label]) | ||
: setRequiredOptions(requiredOptions.filter((x) => x !== option.label)) | ||
} | ||
/> | ||
))} | ||
</section> | ||
); | ||
}; |
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