@@ -39,19 +39,21 @@ const NotificationBannerComponent = forwardRef<HTMLDivElement, NotificationBanne
3939 } , [ moduleRef , instance ] ) ;
4040
4141 const items = Children . toArray ( children ) ;
42+
4243 const titleElement = items . find ( ( child ) =>
43- childIsOfComponentType ( child , NotificationBannerTitle ) ,
44- ) ;
45- const nonTitleItems = items . filter (
46- ( child ) => ! childIsOfComponentType ( child , NotificationBannerTitle ) ,
47- ) ;
48- const headerElement = nonTitleItems . find ( ( child ) =>
49- childIsOfComponentType ( child , NotificationBannerHeading ) ,
44+ childIsOfComponentType ( child , NotificationBannerTitle , {
45+ className : 'nhsuk-notification-banner__title' ,
46+ } ) ,
5047 ) ;
51- const bodyItems = nonTitleItems . filter (
52- ( child ) => ! childIsOfComponentType ( child , NotificationBannerHeading ) ,
48+
49+ const headerElement = items . find ( ( child ) =>
50+ childIsOfComponentType ( child , NotificationBannerHeading , {
51+ className : 'nhsuk-notification-banner__heading' ,
52+ } ) ,
5353 ) ;
5454
55+ const bodyItems = items . filter ( ( child ) => child !== titleElement && child !== headerElement ) ;
56+
5557 if ( instanceError ) {
5658 throw instanceError ;
5759 }
0 commit comments