Skip to content

Commit

Permalink
Decrease checkbox padding to have the same appearance as small icon b…
Browse files Browse the repository at this point in the history
…uttons (#5242)

Don't show in changelog
  • Loading branch information
AlexandreSi committed Apr 18, 2023
1 parent 3abf81f commit bfc6a69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions newIDE/app/src/LayersList/LayerRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ const LayerRow = ({
<React.Fragment>
<InlineCheckbox
id="layer-visibility"
paddingSize="small"
checked={isVisible}
checkedIcon={<VisibilityIcon />}
uncheckedIcon={<VisibilityOffIcon />}
Expand All @@ -199,6 +200,7 @@ const LayerRow = ({
/>
<InlineCheckbox
id="layer-lock"
paddingSize="small"
disabled={!isVisible}
checked={isLocked || !isVisible}
checkedIcon={<LockIcon />}
Expand Down
10 changes: 10 additions & 0 deletions newIDE/app/src/UI/InlineCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const useFormGroupStyles = makeStyles({
},
});

const useSmallPaddingCheckboxStyles = makeStyles({
root: {
padding: 3,
},
});

type Props = {|
id?: string,
label?: ?React.Node,
Expand All @@ -27,6 +33,7 @@ type Props = {|
checkedIcon?: React.Node,
uncheckedIcon?: React.Node,
disabled?: boolean,
paddingSize?: 'small',
tooltipOrHelperText?: React.Node,
|};

Expand All @@ -43,9 +50,11 @@ const InlineCheckbox = ({
uncheckedIcon,
checkedIcon,
tooltipOrHelperText,
paddingSize,
}: Props) => {
const labelClasses = useLabelStyles();
const formGroupClasses = useFormGroupStyles();
const smallPaddingClasses = useSmallPaddingCheckboxStyles();
const checkbox = (
<Checkbox
id={id}
Expand All @@ -54,6 +63,7 @@ const InlineCheckbox = ({
onChange={
onCheck ? event => onCheck(event, event.target.checked) : undefined
}
classes={paddingSize === 'small' ? smallPaddingClasses : null}
icon={uncheckedIcon}
checkedIcon={checkedIcon}
color="secondary"
Expand Down

0 comments on commit bfc6a69

Please sign in to comment.