use built-in carbon options rather than custom classes to style carbon radio buttons (#1195)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-03-13 11:03:23 +00:00 committed by GitHub
parent 420e9e32a8
commit 64910810ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 30 deletions

View File

@ -966,23 +966,6 @@ div.onboarding {
line-height: 48px; line-height: 48px;
} }
.radio-button-group-column {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-inline-end: 0;
}
.radio-button-group-column > * {
margin-bottom: 0.5rem;
}
.radio-button-group-row {
display: flex;
flex-direction: row;
align-items: flex-start;
}
/* Utility classes to create horizontally centered stacks (to align icons etc) */ /* Utility classes to create horizontally centered stacks (to align icons etc) */
.flex-align-horizontal-center { .flex-align-horizontal-center {
display: flex; display: flex;

View File

@ -29,7 +29,6 @@ function RadioWidget({
} }
}; };
const column = uiSchema?.['ui:layout']?.toString().toLowerCase() === 'column';
const _onBlur = ({ target: { value } }: React.FocusEvent<HTMLInputElement>) => const _onBlur = ({ target: { value } }: React.FocusEvent<HTMLInputElement>) =>
onBlur(id, value); onBlur(id, value);
const _onFocus = ({ const _onFocus = ({
@ -58,19 +57,18 @@ function RadioWidget({
onChange={_onChange} onChange={_onChange}
onBlur={_onBlur} onBlur={_onBlur}
onFocus={_onFocus} onFocus={_onFocus}
orientation={row ? 'horizontal' : 'vertical'}
> >
<div className={`radio-button-group-${column ? 'column' : 'row'}`}> {Array.isArray(enumOptions) &&
{Array.isArray(enumOptions) && enumOptions.map((option) => {
enumOptions.map((option) => { return (
return ( <RadioButton
<RadioButton id={`${id}-${option.value}`}
id={`${id}-${option.value}`} labelText={option.label}
labelText={option.label} value={`${option.value}`}
value={`${option.value}`} />
/> );
); })}
})}
</div>
</RadioButtonGroup> </RadioButtonGroup>
); );
} }