@@ -60,10 +60,19 @@ const Footer: Footer = ({ className, children, visuallyHiddenText = 'Support lin
6060 const footerCols = Children . toArray ( children ) . filter ( ( child ) =>
6161 childIsOfComponentType ( child , FooterList ) ,
6262 ) ;
63+ const footerCopyright = Children . toArray ( children ) . filter ( ( child ) =>
64+ childIsOfComponentType ( child , FooterCopyright ) ,
65+ ) ;
6366
64- let newChildren = children ;
67+ let newChildren ;
68+ const footerHasMultipleColumns = footerCols . length > 1 ;
6569
66- if ( footerCols . length === 1 ) {
70+ if ( footerHasMultipleColumns ) {
71+ // Remove the copyright from being rendered inside the 'nhsuk-footer' div
72+ newChildren = Children . toArray ( children ) . filter (
73+ ( child ) => ! childIsOfComponentType ( child , FooterCopyright ) ,
74+ ) ;
75+ } else {
6776 newChildren = Children . map ( children , ( child ) =>
6877 childIsOfComponentType ( child , FooterList )
6978 ? cloneElement ( child , { singleColumn : true } )
@@ -79,6 +88,7 @@ const Footer: Footer = ({ className, children, visuallyHiddenText = 'Support lin
7988 < h2 className = "nhsuk-u-visually-hidden" > { visuallyHiddenText } </ h2 >
8089 ) : null }
8190 < div className = "nhsuk-footer" > { newChildren } </ div >
91+ { footerHasMultipleColumns ? < div > { footerCopyright } </ div > : undefined }
8292 </ Container >
8393 </ div >
8494 </ footer >
0 commit comments