-
Notifications
You must be signed in to change notification settings - Fork 1
๐ fix: DropdownProps๋ฅผ ์ ๋ค๋ฆญ ํ์ ์ผ๋ก ๋ณ๊ฒฝ #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yun-Jinwoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐๐
src/components/common/Dropdown.tsx
Outdated
| interface DropdownProps<OptionType extends string> { | ||
| options: readonly OptionType[]; | ||
| selected: OptionType; | ||
| setSelect: Dispatch<SetStateAction<OptionType>>; // Dispatch<SetStateAction<string>>๋ setํจ์ ํ์ | ||
| placeholder?: string; | ||
| variant: 'form' | 'filter'; | ||
| } | ||
|
|
||
| export default function Dropdown({ | ||
| export default function Dropdown<OptionType extends string>({ | ||
| options, | ||
| selected, | ||
| setSelect, | ||
| placeholder = '์ ํ', | ||
| variant, | ||
| }: DropdownProps) { | ||
| }: DropdownProps<OptionType>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ฌ generic type์ด๋ผ๋ฉด ๊ทธ๋ฅ OptionType ๋ง๊ณ ๊ฐ๋จํ๊ฒ T๋ผ๊ณ ์ ์ด๋ ๋์ง ์๋ ์ถ๋ค์!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ์๋ T๋ก ํ๋ ค๊ณ ํ๋๋ฐ ์ข ๋ ์์๋ณด๊ธฐ ์ข๊ฒ ์ต์ ์ผ๋ก ๋ฃ์์ต๋๋ค!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ณ๊ฒฝํ๊ฒ ์ต๋๋ค!
๐ ๋ณ๊ฒฝ ์ฌํญ ๊ฐ์
DropdownProps๋ฅผ ์ ๋ค๋ฆญ ํ์ ์ผ๋ก ๋ณ๊ฒฝ
๐ ์์ธ ๋ด์ฉ
๋๋กญ๋ค์ด ์์๋ฅผ ํ์ ์ผ๋ก ๋ณ๊ฒฝํจ์ผ๋ก์ ๊ธฐ์กด ๋๋กญ๋ค์ด์ ํ์ ์ด string์ผ๋ก ๋์ด ์ค๋ฅ๊ฐ ๋๋ ๋ถ๋ถ์ ์ ๋ค๋ฆญ ํ์ ์ผ๋ก ๋ณ๊ฒฝํ์ฌ ์ค๋ฅ ์ํ
๐ ๊ด๋ จ ์ด์
๐ผ๏ธ ์คํฌ๋ฆฐ์ท(์ ํ์ฌํญ)
๐ก ์ฐธ๊ณ ์ฌํญ