File tree Expand file tree Collapse file tree 1 file changed +22
-7
lines changed
src/components/warning-callout Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change 11import React , { HTMLProps } from 'react' ;
22import classNames from 'classnames' ;
33
4- const WarningCallout : React . FC < HTMLProps < HTMLDivElement > > = ( {
4+ interface WarningCalloutProps extends HTMLProps < HTMLDivElement > {
5+ labelProps ?: HTMLProps < HTMLHeadingElement > ;
6+ }
7+
8+ const WarningCallout : React . FC < WarningCalloutProps > = ( {
59 className,
610 label,
711 children,
12+ labelProps,
813 ...rest
9- } ) => (
10- < div className = { classNames ( 'nhsuk-warning-callout' ) } { ...rest } >
11- { label ? < h3 className = "nhsuk-warning-callout__label" > { label } </ h3 > : null }
12- { children }
13- </ div >
14- ) ;
14+ } ) => {
15+ const { className : labelClassName , ...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+ } ;
1530
1631export default WarningCallout ;
You can’t perform that action at this time.
0 commit comments