1+ 'use client' ;
2+
13import content from '@content/content' ;
24import { AuthLink } from '@molecules/AuthLink/AuthLink' ;
35import { truncate } from '@utils/truncate' ;
46import Link from 'next/link' ;
57import React from 'react' ;
68
79interface NhsNotifyHeaderWithAccountProps {
8- userName ?: string ;
9- _accountUrl ?: string ;
10- _signOutUrl ?: string ;
11- dataTestId ?: string ;
10+ displayName ?: string ;
11+ clientName ?: string ;
1212}
1313
14- const NhsNotifyHeaderWithAccount : React . FC < NhsNotifyHeaderWithAccountProps > = ( {
15- userName,
16- _accountUrl,
17- _signOutUrl,
18- dataTestId,
19- } ) => (
14+ const headerContent = content . components . header ;
15+
16+ const NhsNotifyHeaderWithAccount = async ( { displayName, clientName } : NhsNotifyHeaderWithAccountProps ) => (
2017 < header
2118 className = 'nhsuk-header'
2219 role = 'banner'
2320 data-module = 'nhsuk-header'
24- data-testid = { dataTestId ?? 'page-header' }
21+ data-testid = 'page-header'
2522 >
2623 < div className = 'nhsuk-header__container nhsuk-width-container' >
2724 < div className = 'nhsuk-header__service' >
2825 < Link
2926 className = 'nhsuk-header__service-logo'
30- href = '/message-templates'
31- aria-label = { content . components . header . links . logoLink . ariaLabel }
27+ href = { headerContent . logoLink . href }
28+ aria-label = { headerContent . logoLink . ariaLabel }
3229 >
3330 < svg
3431 className = 'nhsuk-header__logo'
@@ -40,70 +37,65 @@ const NhsNotifyHeaderWithAccount: React.FC<NhsNotifyHeaderWithAccountProps> = ({
4037 role = 'img'
4138 aria-label = 'NHS'
4239 >
43- < title > { content . components . header . links . logoLink . logoTitle } </ title >
40+ < title > { headerContent . logoLink . logoTitle } </ title >
4441 < path
4542 fill = 'currentcolor'
4643 d = 'M200 0v80H0V0h200Zm-27.5 5.5c-14.5 0-29 5-29 22 0 10.2 7.7 13.5 14.7 16.3l.7.3c5.4 2 10.1 3.9 10.1 8.4 0 6.5-8.5 7.5-14 7.5s-12.5-1.5-16-3.5L135 70c5.5 2 13.5 3.5 20 3.5 15.5 0 32-4.5 32-22.5 0-19.5-25.5-16.5-25.5-25.5 0-5.5 5.5-6.5 12.5-6.5a35 35 0 0 1 14.5 3l4-13.5c-4.5-2-12-3-20-3Zm-131 2h-22l-14 65H22l9-45h.5l13.5 45h21.5l14-65H64l-9 45h-.5l-13-45Zm63 0h-18l-13 65h17l6-28H117l-5.5 28H129l13.5-65H125L119.5 32h-20l5-24.5Z'
4744 />
4845 </ svg >
4946 < span className = 'nhsuk-header__service-name' >
50- { content . components . header . serviceName }
47+ { headerContent . serviceName }
5148 </ span >
5249 </ Link >
5350 </ div >
54- < nav className = 'nhsuk-header__account' aria-label = 'Account' >
51+ < nav
52+ className = 'nhsuk-header__account'
53+ aria-label = { headerContent . accountInfo . ariaLabel }
54+ >
5555 < ul className = 'nhsuk-header__account-list' >
56- < li className = 'nhsuk-header__account-item' >
57- < svg
58- className = 'nhsuk-icon nhsuk-icon__user'
59- xmlns = 'http://www.w3.org/2000/svg'
60- viewBox = '0 0 24 24'
61- aria-hidden = 'true'
62- focusable = 'false'
63- >
64- < path d = 'M12 1a11 11 0 1 1 0 22 11 11 0 0 1 0-22Zm0 2a9 9 0 0 0-5 16.5V18a4 4 0 0 1 4-4h2a4 4 0 0 1 4 4v1.5A9 9 0 0 0 12 3Zm0 3a3.5 3.5 0 1 1-3.5 3.5A3.4 3.4 0 0 1 12 6Z' > </ path >
65- </ svg >
66- { truncate ( 'Florence Nightingale (Regional Manager)' ) }
67- </ li >
68- < li className = 'nhsuk-header__account-item' >
69- { truncate ( 'Client name' ) }
70- </ li >
56+ { displayName && (
57+ < li className = 'nhsuk-header__account-item' >
58+ < svg
59+ className = 'nhsuk-icon nhsuk-icon__user'
60+ xmlns = 'http://www.w3.org/2000/svg'
61+ viewBox = '0 0 24 24'
62+ aria-hidden = 'true'
63+ focusable = 'false'
64+ >
65+ < path d = 'M12 1a11 11 0 1 1 0 22 11 11 0 0 1 0-22Zm0 2a9 9 0 0 0-5 16.5V18a4 4 0 0 1 4-4h2a4 4 0 0 1 4 4v1.5A9 9 0 0 0 12 3Zm0 3a3.5 3.5 0 1 1-3.5 3.5A3.4 3.4 0 0 1 12 6Z' > </ path >
66+ </ svg >
67+ { truncate ( displayName ) }
68+ </ li >
69+ ) }
70+ { clientName && (
71+ < li className = 'nhsuk-header__account-item' >
72+ { truncate ( clientName ) }
73+ </ li >
74+ ) }
7175 < li className = 'nhsuk-header__account-item' >
7276 < AuthLink className = 'nhsuk-header__account-link' />
7377 </ li >
7478 </ ul >
7579 </ nav >
7680 </ div >
77- < nav className = 'nhsuk-header__navigation' aria-label = 'Menu' >
81+ < nav
82+ className = 'nhsuk-header__navigation'
83+ aria-label = { headerContent . navigationMenu . ariaLabel }
84+ >
7885 < div className = 'nhsuk-header__navigation-container nhsuk-width-container' >
7986 < ul className = 'nhsuk-header__navigation-list' >
80- { content . components . header . nav . map ( ( { text, href } , index ) => {
87+ { headerContent . navigationMenu . links . map ( ( { text, href } , index ) => {
8188 return (
82- < li className = 'nhsuk-header__navigation-item' >
89+ < li
90+ className = 'nhsuk-header__navigation-item'
91+ key = { `item-${ index } ` }
92+ >
8393 < Link className = 'nhsuk-header__navigation-link' href = { href } >
8494 { text }
8595 </ Link >
8696 </ li >
8797 ) ;
8898 } ) }
89- < li className = 'nhsuk-header__menu' hidden >
90- < button
91- className = 'nhsuk-header__menu-toggle nhsuk-header__navigation-link'
92- id = 'toggle-menu'
93- aria-expanded = 'false'
94- >
95- < span className = 'nhsuk-u-visually-hidden' > Browse </ span > More
96- < svg
97- className = 'nhsuk-icon nhsuk-icon__chevron-down'
98- xmlns = 'http://www.w3.org/2000/svg'
99- viewBox = '0 0 24 24'
100- aria-hidden = 'true'
101- focusable = 'false'
102- >
103- < path d = 'M15.5 12a1 1 0 0 1-.29.71l-5 5a1 1 0 0 1-1.42-1.42l4.3-4.29-4.3-4.29a1 1 0 0 1 1.42-1.42l5 5a1 1 0 0 1 .29.71z' > </ path >
104- </ svg >
105- </ button >
106- </ li >
10799 </ ul >
108100 </ div >
109101 </ nav >
0 commit comments