Skip to content

Commit

Permalink
chore: address first round of PR comments - tbs
Browse files Browse the repository at this point in the history
  • Loading branch information
DipperTheDan committed Sep 19, 2024
1 parent 13f739d commit 9cbd215
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 805 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const CheckableInput = React.forwardRef(
>
<InputBehaviour>
<FormField {...formFieldProps} my={0}>
<StyledCheckableInput>
<StyledCheckableInput data-role="checkable-input">
<HiddenCheckableInput {...inputProps} />
{children}
</StyledCheckableInput>
Expand Down
15 changes: 12 additions & 3 deletions src/components/switch/switch.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export const Switch = React.forwardRef(

const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
let shouldLabelBeInline: boolean | undefined = labelInline;
// Coverage has been ignored here as this functionality is covered in a Playwright test.
/* istanbul ignore next */
if (adaptiveLabelBreakpoint) {
shouldLabelBeInline = largeScreen;
}
Expand Down Expand Up @@ -208,14 +210,21 @@ export const Switch = React.forwardRef(
{validationRedesignOptIn ? (
<StyledSwitch {...switchStylePropsForNewValidation}>
<Label>
<Box mb={labelHelp ? 0 : 1}>
<Box data-role="hint-text-wrapper" mb={labelHelp ? 0 : 1}>
{label}
{labelHelp && <StyledHintText>{labelHelp}</StyledHintText>}
{labelHelp && (
<StyledHintText data-role="hint-text">
{labelHelp}
</StyledHintText>
)}
</Box>
<Box position="relative">
<ValidationMessage error={error} warning={warning} />
{applyValidation && (
<ErrorBorder warning={!!(!error && warning)} />
<ErrorBorder
data-role="error-border"
warning={!!(!error && warning)}
/>
)}
<CheckableInput {...inputPropsForNewValidation}>
<SwitchSlider {...switchSliderPropsForNewValidation} />
Expand Down
Loading

0 comments on commit 9cbd215

Please sign in to comment.