Skip to content

Commit

Permalink
feat(nhsuk-frontend-react): replace form group error line prop
Browse files Browse the repository at this point in the history
BREAKING CHANGE: replace disableErrorLine with withErrorLine
  • Loading branch information
rowellx68 committed Sep 27, 2024
1 parent 87ff4ec commit 1fa696d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type BaseFormElementProps = {
hintProps?: HintProps;
errorProps?: ErrorMessageProps;
formGroupProps?: ElementProps<'div'>;
disableErrorLine?: boolean;
withErrorLine?: boolean;
};

type FormGroupProps = BaseFormElementProps & {
Expand Down Expand Up @@ -65,7 +65,7 @@ const _FormGroup = forwardRef<HTMLInputElement, FormGroupProps>(
render,
formGroupProps = {},
fieldsetProps = {},
disableErrorLine,
withErrorLine,
error,
label,
hint,
Expand Down Expand Up @@ -160,7 +160,7 @@ const _FormGroup = forwardRef<HTMLInputElement, FormGroupProps>(
className: clsx(
'nhsuk-form-group',
{
'nhsuk-form-group--error': !disableErrorLine && error,
'nhsuk-form-group--error': withErrorLine && error,
},
formGroupClass,
),
Expand All @@ -177,7 +177,7 @@ const _FormGroup = forwardRef<HTMLInputElement, FormGroupProps>(
className: clsx(
'nhsuk-form-group',
{
'nhsuk-form-group--error': !disableErrorLine && error,
'nhsuk-form-group--error': withErrorLine && error,
},
formGroupClass,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const Checkbox = factory<CheckboxFactory>(({ children, ...props }, ref) => {
<CheckboxProvider value={value}>
<FormGroup
as="div"
withErrorLine
{...props}
ref={internalRef}
inputType="checkboxes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const DateInput = factory<DateInputFactory>(
return (
<FormGroup
as="div"
withErrorLine
{...props}
ref={ref}
fieldsetProps={{ role: 'group' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const Input = factory<InputFactory>(
return (
<FormGroup
as="input"
withErrorLine
{...props}
ref={ref}
inputType="input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Radio = factory<RadioFactory>(({ children, inline, ...props }, ref) => {
<RadioProvider value={value}>
<FormGroup
as="div"
withErrorLine
{...props}
ref={internalRef}
inputType="radios"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Select = factory<SelectFactory>((props, ref) => {
<FormGroup
as="select"
inputType="select"
withErrorLine
{...props}
ref={ref}
render={({ id, name, className, withError, ...rest }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const Textarea = factory<TextareaFactory>(
<FormGroup
as="textarea"
inputType="textarea"
withErrorLine
{...props}
ref={internalRef}
render={({ id, name, className, withError, ...rest }) => (
Expand Down

0 comments on commit 1fa696d

Please sign in to comment.