Skip to content

Commit

Permalink
simpler solution
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 9, 2021
1 parent 3f9fb0b commit b13b4e6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/material-ui/src/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ const useUtilityClasses = (styleProps) => {
root: ['root', indeterminate && 'indeterminate', `color${capitalize(color)}`],
};

return composeClasses(slots, getCheckboxUtilityClass, classes);
const finalClasses = composeClasses(slots, getCheckboxUtilityClass, classes);

return {
...classes, // forward the disabled and checked classes to the SwitchBase
...finalClasses,
};
};

const CheckboxRoot = experimentalStyled(
Expand Down Expand Up @@ -71,7 +76,6 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
const props = useThemeProps({ props: inProps, name: 'MuiCheckbox' });
const {
checkedIcon = defaultCheckedIcon,
classes: classesProp = {},
color = 'secondary',
icon: iconProp = defaultIcon,
indeterminate = false,
Expand All @@ -86,7 +90,6 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {

const styleProps = {
...props,
classes: classesProp,
color,
indeterminate,
size,
Expand Down Expand Up @@ -114,12 +117,8 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
})}
styleProps={styleProps}
ref={ref}
classes={{
root: classes.root,
checked: classesProp.checked,
disabled: classesProp.disabled,
}}
{...other}
classes={classes}
/>
);
});
Expand Down

0 comments on commit b13b4e6

Please sign in to comment.