generated from GSM-MSG/MSG-Repository-Generator
-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
e4259a2
commit b5338d9
Showing
5 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
18 changes: 14 additions & 4 deletions
18
packages/app/src/features/register/hooks/useMajorAutoComplete.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
39 changes: 39 additions & 0 deletions
39
packages/app/src/features/student/atoms/MajorListSection/index.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,39 @@ | ||
import { Checkbox, SkeletonText } from '@sms/shared' | ||
import CheckboxSection from '@features/student/atoms/CheckboxSection' | ||
import useMajorAutoComplete from '@features/register/hooks/useMajorAutoComplete' | ||
import { UseFormWatch } from 'react-hook-form' | ||
|
||
interface Props { | ||
onClickMajor(major: string): void | ||
watch: UseFormWatch<StudentParam> | ||
} | ||
|
||
const MajorListSection = ({ onClickMajor, watch }: Props) => { | ||
const { majorList, isLoading } = useMajorAutoComplete() | ||
|
||
return ( | ||
<CheckboxSection isShow={true} title='분야'> | ||
{isLoading && | ||
Array(...Array(10)).map((_, i) => ( | ||
<Checkbox key={i}> | ||
<SkeletonText width={`${i + 1}0%`} /> | ||
</Checkbox> | ||
))} | ||
|
||
{!isLoading && | ||
[...(majorList || []), '기타']?.map((major) => ( | ||
<Checkbox | ||
key={major} | ||
value={major} | ||
onClick={() => onClickMajor(major)} | ||
checked={watch('majors')?.includes(major)} | ||
readOnly | ||
> | ||
{major} | ||
</Checkbox> | ||
))} | ||
</CheckboxSection> | ||
) | ||
} | ||
|
||
export default MajorListSection |
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