[SDR-422] FE : Button, Icon, Logo atom 추가합니다.#244
Open
yongseongjeon wants to merge 7 commits intodevfrom
Open
Conversation
youryu0212
requested changes
Dec 11, 2022
Comment on lines
+15
to
+16
| size?: 'LARGE' | 'SMALL'; | ||
| backgroundColor?: 'YELLOW' | 'BLUE'; |
Member
There was a problem hiding this comment.
enum COLOR = {
YELLOW = 'YELLOW',
BLUE = 'BLUE',
};처럼 enum을 정의한 후 타입 정의할때는 enum을 활용하는게 좋을 것 같아요
// ex)
type ButtonProps = {
...
backgroundColor?: COLOR
}| type ButtonProps = { | ||
| size?: 'LARGE' | 'SMALL'; | ||
| backgroundColor?: 'YELLOW' | 'BLUE'; | ||
| children: React.ReactNode; |
Member
There was a problem hiding this comment.
type ButtonProps = { } & JSX.IntrinsicElements['button']형태를 활용하면 children이나 onClick등은 별도 타입선언을 안해도 될것같아요!
| backgroundColor: 'YELLOW', | ||
| }; | ||
|
|
||
| export const Small = Template.bind({}); |
Member
There was a problem hiding this comment.
Small이 디폴트라면 Default로 네이밍 하는것도 나쁘지 않아 보이는데 어떻게 생각하시나요?
|
|
||
| type IconProps = { | ||
| type: IconComponentsKeys; | ||
| color?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'; |
Collaborator
Author
There was a problem hiding this comment.
아이콘이 전부 MUI로 구성되어 있어서 아이콘 컴포넌트 API와 동일하게 타입을 정해봤어요.
https://mui.com/material-ui/api/icon/#props
Comment on lines
+39
to
+41
| if (!SelectedIcon) { | ||
| throw new Error(`${type} 컴포넌트를 찾을 수 없습니다. `); | ||
| } |
Member
There was a problem hiding this comment.
type을 강제했는데 예외상황이 발생할 수 있나요?
Collaborator
Author
There was a problem hiding this comment.
ts 사용하기 전에 저렇게 예외처리 해놓았는데 이젠 그럴 필요가 없겠군요!
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 구현 내용
<Button /><Icon /><Logo /><Text />🙇🏻♂️ 리뷰어에게 부탁합니다!
https://west-train-b77.notion.site/203c6073ad104daf8164bd369b6d283a?v=b43ef169c7c54e2e9a281e5d093bb40d
<Text />,<Avatar />,<SpeechBuble />,<Card />,<Box />,<Switch />생성 예정입니다.