Skip to content

Commit

Permalink
fead: Added noPadding option to Radio.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cerberupo committed Jan 17, 2024
1 parent 36d96af commit a04fec5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions packages/components/src/form/Radio/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ const Radio = forwardRef(
size,
useAria,
onChange,
noRootPadding,
...props
},
ref
ref,
) => {
const { classes, cx } = RadioStyles(
{ checked, variant, help, helpPosition, icon, image, children, label },
{ name: 'Radio' }
{ checked, variant, help, helpPosition, icon, image, children, label, noRootPadding },
{ name: 'Radio' },
);

const handleOnChange = () => {
Expand Down Expand Up @@ -73,7 +74,7 @@ const Radio = forwardRef(
/>
</Box>
);
}
},
);

Radio.defaultProps = {
Expand Down
11 changes: 7 additions & 4 deletions packages/components/src/form/Radio/Radio.styles.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../theme.mixins';
import { getFontProductive, pxToRem } from '../../theme.mixins';

export const RadioStyles = createStyles(
(theme, { variant, help, helpPosition, checked, icon, image, children, label }) => {
(
theme,
{ variant, help, helpPosition, checked, icon, image, children, label, noRootPadding },
) => {
const isIcon = variant === 'icon';
const isDefault = variant === 'default';
const isImage = variant === 'image';
Expand All @@ -22,7 +25,7 @@ export const RadioStyles = createStyles(
cursor: isImage && 'pointer',
},
root: {
padding: 14,
padding: noRootPadding ? 0 : 14,
display: isIcon && 'flex',
justifyContent: isIcon && 'center',
alignItems: isIcon && 'center',
Expand Down Expand Up @@ -76,5 +79,5 @@ export const RadioStyles = createStyles(
display: isIcon && 'none',
},
};
}
},
);

0 comments on commit a04fec5

Please sign in to comment.