Skip to content

Commit

Permalink
fix(checkbox): fix color params (#1497)
Browse files Browse the repository at this point in the history
Co-authored-by: ZhaoChen <ittisennsinn@gmail.com>
  • Loading branch information
itiiss and itiisennsinn committed Nov 22, 2021
1 parent 6308e5b commit 3f2e640
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Checkbox = WithRef<HTMLInputElement, CheckboxProps>((props, ref) => {
defaultChecked = false,
checked,
disabled = false,
color = 'transparent',
color,
value = '',
children,
className,
Expand Down Expand Up @@ -75,6 +75,8 @@ const Checkbox = WithRef<HTMLInputElement, CheckboxProps>((props, ref) => {
checkboxProps.disabled = disabled || checkboxGroup.disabled;
}

const inputStyle = { background: color, borderColor: color };

return (
// eslint-disable-next-line jsx-a11y/label-has-associated-control
<label className={checkboxCls} style={style}>
Expand All @@ -87,7 +89,7 @@ const Checkbox = WithRef<HTMLInputElement, CheckboxProps>((props, ref) => {
value={value}
checked={checkedStatus}
onChange={handleChange}
color={color}
style={inputStyle}
{...checkboxProps}
/>
<span>{children}</span>
Expand All @@ -101,7 +103,6 @@ Checkbox.defaultProps = {
indeterminate: false,
defaultChecked: false,
disabled: false,
color: 'transparent',
};

export default Checkbox;
4 changes: 2 additions & 2 deletions src/checkbox/demos/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ const DemoTemplate = () => {
<tr>
<td>color checked</td>
<td>
<Checkbox checked style={{ background: 'red', borderColor: 'red' }}>
<Checkbox checked color="red">
我已阅读以下条款
</Checkbox>
</td>
</tr>
<tr>
<td>color indeterminate</td>
<td>
<Checkbox checked indeterminate style={{ background: 'red', borderColor: 'red' }}>
<Checkbox checked indeterminate color="red">
我已阅读以下条款
</Checkbox>
</td>
Expand Down

1 comment on commit 3f2e640

@vercel
Copy link

@vercel vercel bot commented on 3f2e640 Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.