-
Notifications
You must be signed in to change notification settings - Fork 2
[#44] ✨ 공통 컴포넌트 RadioInput 컴포넌트 구현 #94
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
Changes from 3 commits
d84fc51
06bd589
5ffd324
734112b
bea145c
e43bf43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import clsx from 'clsx' | ||
|
|
||
| interface RadioInputProps extends React.InputHTMLAttributes<HTMLInputElement> { | ||
| label: string | ||
| } | ||
|
|
||
| export const RadioInput = ({ | ||
| label, | ||
| className = '', | ||
| checked, | ||
| disabled, | ||
| ...props | ||
| }: RadioInputProps): JSX.Element => { | ||
| return ( | ||
| <label | ||
| className={clsx( | ||
| 'flex cursor-pointer items-center', | ||
| disabled && 'cursor-not-allowed opacity-50', | ||
| className | ||
| )} | ||
|
||
| > | ||
| <input type='radio' checked={checked} disabled={disabled} {...props} /> | ||
| <span className='custom-radio'></span> | ||
|
||
| <span className='text-body-2 ml-4 h-22 font-normal leading-body2 text-gray-800'> | ||
| {label} | ||
| </span> | ||
| </label> | ||
| ) | ||
| } | ||
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.
https://juhyejin.tistory.com/54
원래 input 의 display 를 none 으로 하면서, 접근성 면에서 손해를 보는 현상이 있는거 같아요. 해당 아티클 참고하면 좋을거 같습니다 !