Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues in new CheckBox component + fix styling RadioButtonGroup #1551

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/layout/Checkboxes/CheckboxesContainerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const CheckboxContainerComponent = ({
}
};

const labelText = (
const labelTextGroup = (
<span className={classes.checkBoxLabelContainer}>
{lang(node.item.textResourceBindings?.title)}
<RequiredIndicator required={required} />
Expand Down Expand Up @@ -91,11 +91,11 @@ export const CheckboxContainerComponent = ({
>
<Checkbox.Group
className={cn({ [classes.horizontal]: horizontal })}
legend={labelText}
legend={labelTextGroup}
description={lang(textResourceBindings?.description)}
disabled={readOnly}
onChange={(values) => handleChange(values)}
hideLegend={overrideDisplay?.renderLegend}
hideLegend={overrideDisplay?.renderLegend === false}
error={!isValid}
aria-label={ariaLabel}
value={selected}
Expand All @@ -110,14 +110,14 @@ export const CheckboxContainerComponent = ({
checked={selected.includes(option.value)}
size='small'
>
{hideLabel ? null : (
<span className={classes.checkBoxLabelContainer}>
{
<span className={cn({ 'sr-only': hideLabel }, classes.checkBoxLabelContainer)}>
{langAsString(option.label)}
{option.helpText && (
<HelpText title={getPlainTextFromNode(option.helpText)}>{lang(option.helpText)}</HelpText>
)}
</span>
)}
}
</Checkbox>
))}
</Checkbox.Group>
Expand Down
19 changes: 9 additions & 10 deletions src/layout/RadioButtons/ControlledRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,16 @@ export const ControlledRadioGroup = (props: IControlledRadioGroupProps) => {
>
<Radio.Group
legend={
overrideDisplay?.renderLegend === false ? null : (
<span className={classes.label}>
{labelText}
{textResourceBindings?.help ? (
<HelpText title={langAsString(textResourceBindings?.help)}>
{lang(textResourceBindings?.help)}
</HelpText>
) : null}
</span>
)
<span className={classes.label}>
{labelText}
{textResourceBindings?.help ? (
<HelpText title={langAsString(textResourceBindings?.help)}>
{lang(textResourceBindings?.help)}
</HelpText>
) : null}
</span>
}
hideLegend={overrideDisplay?.renderLegend === false}
description={lang(textResourceBindings?.description)}
error={!isValid}
disabled={readOnly}
Expand Down