From a04fec52b6f68cd5d382d869ef599d9fba88825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Go=CC=81mez=20Cimarro?= Date: Wed, 17 Jan 2024 16:04:19 +0100 Subject: [PATCH] fead: Added noPadding option to Radio. --- packages/components/src/form/Radio/Radio.js | 9 +++++---- packages/components/src/form/Radio/Radio.styles.js | 11 +++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/components/src/form/Radio/Radio.js b/packages/components/src/form/Radio/Radio.js index 08399cf5a..87d5eadfb 100644 --- a/packages/components/src/form/Radio/Radio.js +++ b/packages/components/src/form/Radio/Radio.js @@ -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 = () => { @@ -73,7 +74,7 @@ const Radio = forwardRef( /> ); - } + }, ); Radio.defaultProps = { diff --git a/packages/components/src/form/Radio/Radio.styles.js b/packages/components/src/form/Radio/Radio.styles.js index 9e7288299..eeb811da3 100644 --- a/packages/components/src/form/Radio/Radio.styles.js +++ b/packages/components/src/form/Radio/Radio.styles.js @@ -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'; @@ -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', @@ -76,5 +79,5 @@ export const RadioStyles = createStyles( display: isIcon && 'none', }, }; - } + }, );