Skip to content

Commit

Permalink
Checkbox disabled 스타일 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
cause38 committed Apr 15, 2024
1 parent 773a4b5 commit 9915d69
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/components/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const Checkbox = forwardRef((
svgSize = SVG_SIZE["SIZE_24"],
isCircle = false,
className,
disabled,
...props
}: CheckboxProps,
ref: React.ComponentPropsWithRef<"input">["ref"],
Expand All @@ -24,8 +25,12 @@ const Checkbox = forwardRef((
const svg = !isCircle ? RectangleCheckbox : CircleCheckbox;

return (
<label onClick = {(e: MouseEvent<HTMLLabelElement>) => e.stopPropagation()} htmlFor = {id} className = {clsx("cursor-pointer", label && "flex items-center gap-2.5", className)}>
<input ref = {ref} id = {id} type = "checkbox" className = "peer hidden" {...props}/>
<label
onClick = {(e: MouseEvent<HTMLLabelElement>) => e.stopPropagation()}
htmlFor = {id}
className = {clsx({ "flex items-center gap-2.5": label, "cursor-not-allowed": disabled, "cursor-pointer": !disabled }, className)}
>
<input ref = {ref} id = {id} type = "checkbox" className = "peer hidden" disabled = {disabled} {...props}/>
<div className = {`${CHECKBOX_SVG_SIZE[svgSize]} [&>svg>path]:fill-[#C6CEDE] peer-checked:[&>svg>path]:fill-primary-03`}>
{svg}
</div>
Expand Down

0 comments on commit 9915d69

Please sign in to comment.