-
Notifications
You must be signed in to change notification settings - Fork 5
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
[SDR-422] FE : Button, Icon, Logo atom 추가합니다. #244
base: dev
Are you sure you want to change the base?
Conversation
size?: 'LARGE' | 'SMALL'; | ||
backgroundColor?: 'YELLOW' | 'BLUE'; |
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.
enum COLOR = {
YELLOW = 'YELLOW',
BLUE = 'BLUE',
};
처럼 enum을 정의한 후 타입 정의할때는 enum을 활용하는게 좋을 것 같아요
// ex)
type ButtonProps = {
...
backgroundColor?: COLOR
}
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.
size나 다른 부분도 마찬가지입니다.
type ButtonProps = { | ||
size?: 'LARGE' | 'SMALL'; | ||
backgroundColor?: 'YELLOW' | 'BLUE'; | ||
children: React.ReactNode; |
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.
type ButtonProps = { } & JSX.IntrinsicElements['button']
형태를 활용하면 children이나 onClick등은 별도 타입선언을 안해도 될것같아요!
backgroundColor: 'YELLOW', | ||
}; | ||
|
||
export const Small = Template.bind({}); |
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.
Small이 디폴트라면 Default로 네이밍 하는것도 나쁘지 않아 보이는데 어떻게 생각하시나요?
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.
좋아요 ㅎㅎ
|
||
type IconProps = { | ||
type: IconComponentsKeys; | ||
color?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'; |
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.
color..?
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.
아이콘이 전부 MUI로 구성되어 있어서 아이콘 컴포넌트 API와 동일하게 타입을 정해봤어요.
https://mui.com/material-ui/api/icon/#props
if (!SelectedIcon) { | ||
throw new Error(`${type} 컴포넌트를 찾을 수 없습니다. `); | ||
} |
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.
type을 강제했는데 예외상황이 발생할 수 있나요?
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.
ts 사용하기 전에 저렇게 예외처리 해놓았는데 이젠 그럴 필요가 없겠군요!
📝 구현 내용
<Button />
<Icon />
<Logo />
<Text />
🙇🏻♂️ 리뷰어에게 부탁합니다!
https://west-train-b77.notion.site/203c6073ad104daf8164bd369b6d283a?v=b43ef169c7c54e2e9a281e5d093bb40d
<Text />
,<Avatar />
,<SpeechBuble />
,<Card />
,<Box />
,<Switch />
생성 예정입니다.