Skip to content

Commit 3328736

Browse files
authored
Allow for additional classNames without override
1 parent 4f53493 commit 3328736

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/components/warning-callout/WarningCallout.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ const WarningCallout: React.FC<WarningCalloutProps> = ({
1111
children,
1212
labelProps,
1313
...rest
14-
}) => (
15-
<div className={classNames('nhsuk-warning-callout', className)} {...rest}>
16-
{label ? (
17-
<h3
18-
className={classNames('nhsuk-warning-callout__label', labelProps?.className)}
19-
{...labelProps}
20-
>
21-
{label}
22-
</h3>
23-
) : null}
24-
{children}
25-
</div>
26-
);
14+
}) => {
15+
const { labelClassName: className, ...restLabelProps } = labelProps || {};
16+
return (
17+
<div className={classNames('nhsuk-warning-callout', className)} {...rest}>
18+
{label ? (
19+
<h3
20+
className={classNames('nhsuk-warning-callout__label', labelClassName)}
21+
{...restLabelProps}
22+
>
23+
{label}
24+
</h3>
25+
) : null}
26+
{children}
27+
</div>
28+
);
29+
}
2730

2831
export default WarningCallout;

0 commit comments

Comments
 (0)