-
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
Input, Label 공통 컴포넌트 개발 (+ 컨테이너, 훅) #32
Conversation
src/component/common/Input/Label.tsx
Outdated
styles?: Interpolation<Theme>; | ||
} & React.LabelHTMLAttributes<HTMLLabelElement>; | ||
|
||
export const Label = ({ id, children, order, styles }: LabelProps) => { |
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.
컴포넌트면 함수 선언문이죠?!
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.
오앗 감사합니다 !!
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.
고생하셨습니다요 ✨
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/hooks/useInput.ts
Outdated
type UseInputReturn = [string, (e: React.ChangeEvent<HTMLInputElement>) => void]; | ||
|
||
export const useInput = (defaultValue?: string): UseInputReturn => { | ||
const [value, setValue] = useState(defaultValue || ""); | ||
|
||
const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { | ||
setValue(e.target.value); | ||
}, []); | ||
|
||
return [value, handleInputChange]; | ||
}; |
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.
해당 부분도 as const로 return 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.
아이쿠 여기도 수정한다는 걸 깜빡했네요!! 확인 감사합니다!!
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.
수고하셨습니다:)
e347b70
to
3b70ba1
Compare
🏄🏼♂️ Summary (요약)
🫨 Describe your Change (변경사항)
관련 변경 파일들입니다!
InputLabelContainer
에 id를 전달하면 라벨과 인풋에 해당 id가 부여됩니다.InputLabelContainer
에는 라벨과 인풋을 감싸는 부모 엘리먼트를 포함합니다. (간격 스타일 포함)Label
의order
prop 은 라벨에 포함될 넘버링을 나타냅니다. 전달하지 않으면 넘버링 없이 텍스트 라벨만 출력됩니다. (아래 예시)🧐 Issue number and link (참고)
📚 Reference (참조)