From 230bf09e9d08796d53ed1b9153222f0875d9462b Mon Sep 17 00:00:00 2001 From: Frankie Roberto Date: Fri, 29 Nov 2024 11:08:16 +0000 Subject: [PATCH] Change primaryLinks to use href and text instead of url and label (#1083) Change the primaryLinks in the Header component to use `href` and `text` param names instead of `url` and `label`. This improves consistency with other components. The previous param names are still supported for backwards-compatibility (but could be dropped in future) --- app/components/all.njk | 20 ++-- app/components/header/header-navigation.njk | 20 ++-- .../header/header-org-white-nav.njk | 20 ++-- app/components/header/header-org-white.njk | 20 ++-- app/components/header/header-org.njk | 20 ++-- .../header/header-service-name-with-nav.njk | 16 +-- app/components/header/index.njk | 20 ++-- packages/components/header/README.md | 112 +++++++++--------- packages/components/header/template.njk | 2 +- 9 files changed, 125 insertions(+), 125 deletions(-) diff --git a/app/components/all.njk b/app/components/all.njk index 07bf58089..6c39029ae 100644 --- a/app/components/all.njk +++ b/app/components/all.njk @@ -39,24 +39,24 @@ "search": true, "primaryLinks": [ { - "url" : "https://www.nhs.uk/conditions", - "label" : "Health A-Z" + href: "https://www.nhs.uk/conditions", + text: "Health A-Z" }, { - 'url' : 'https://www.nhs.uk/live-well/', - 'label' : 'Live Well' + href: 'https://www.nhs.uk/live-well/', + text: 'Live Well' }, { - 'url' : 'https://www.nhs.uk/conditions/social-care-and-support/', - 'label' : 'Care and support' + href: 'https://www.nhs.uk/conditions/social-care-and-support/', + text: 'Care and support' }, { - 'url' : 'https://www.nhs.uk/news/', - 'label' : 'Health news' + href: 'https://www.nhs.uk/news/', + text: 'Health news' }, { - 'url' : 'https://www.nhs.uk/service-search', - 'label' : 'Services near you' + href: 'https://www.nhs.uk/service-search', + text: 'Services near you' } ] }) diff --git a/app/components/header/header-navigation.njk b/app/components/header/header-navigation.njk index 0f0c401f5..3ad96e0ff 100644 --- a/app/components/header/header-navigation.njk +++ b/app/components/header/header-navigation.njk @@ -16,24 +16,24 @@ } }, { - 'url' : 'https://www.nhs.uk/live-well/', - 'label' : 'Live Well' + href: 'https://www.nhs.uk/live-well/', + text: 'Live Well' }, { - 'url' : 'https://www.nhs.uk/mental-health/', - 'label' : 'Mental health' + href: 'https://www.nhs.uk/mental-health/', + text: 'Mental health' }, { - 'url' : 'https://www.nhs.uk/conditions/social-care-and-support/', - 'label' : 'Care and support' + href: 'https://www.nhs.uk/conditions/social-care-and-support/', + text: 'Care and support' }, { - 'url' : 'https://www.nhs.uk/pregnancy/', - 'label' : 'Pregnancy' + href: 'https://www.nhs.uk/pregnancy/', + text: 'Pregnancy' }, { - 'url' : 'https://www.nhs.uk/nhs-services/', - 'label' : 'NHS services' + href: 'https://www.nhs.uk/nhs-services/', + text: 'NHS services' } ] }) diff --git a/app/components/header/header-org-white-nav.njk b/app/components/header/header-org-white-nav.njk index 7c70723b5..046a3164e 100644 --- a/app/components/header/header-org-white-nav.njk +++ b/app/components/header/header-org-white-nav.njk @@ -14,24 +14,24 @@ }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ], "search": { diff --git a/app/components/header/header-org-white.njk b/app/components/header/header-org-white.njk index e80591c12..088e1bc2e 100644 --- a/app/components/header/header-org-white.njk +++ b/app/components/header/header-org-white.njk @@ -14,24 +14,24 @@ }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ], "search": { diff --git a/app/components/header/header-org.njk b/app/components/header/header-org.njk index 125acaf40..f344c213d 100644 --- a/app/components/header/header-org.njk +++ b/app/components/header/header-org.njk @@ -13,24 +13,24 @@ }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ], "search": { diff --git a/app/components/header/header-service-name-with-nav.njk b/app/components/header/header-service-name-with-nav.njk index 0ea14124f..2ea9735a5 100644 --- a/app/components/header/header-service-name-with-nav.njk +++ b/app/components/header/header-service-name-with-nav.njk @@ -14,24 +14,24 @@ }, "primaryLinks": [ { - "url" : "#", - "label" : "Standards and technology" + href: "#", + text: "Standards and technology" }, { - 'url' : '#', - 'label' : 'Design system' + href: '#', + text: 'Design system' }, { 'url' : '#', - 'label' : 'Content style guide' + text: 'Content style guide' }, { 'url' : '#', - 'label' : 'Accessibility' + text: 'Accessibility' }, { - 'url' : '#', - 'label' : 'Community and contribution' + href: '#', + text: 'Community and contribution' } ] }) diff --git a/app/components/header/index.njk b/app/components/header/index.njk index 857b22385..8e2a35d73 100644 --- a/app/components/header/index.njk +++ b/app/components/header/index.njk @@ -9,28 +9,28 @@ "search": true, "primaryLinks": [ { - "url" : "https://www.nhs.uk/conditions", - "label" : "Health A-Z" + href: "https://www.nhs.uk/conditions", + text: "Health A-Z" }, { - 'url' : 'https://www.nhs.uk/live-well/', - 'label' : 'Live Well' + href: 'https://www.nhs.uk/live-well/', + text: 'Live Well' }, { - 'url' : 'https://www.nhs.uk/mental-health/', - 'label' : 'Mental health' + href: 'https://www.nhs.uk/mental-health/', + text: 'Mental health' }, { 'url' : 'https://www.nhs.uk/conditions/social-care-and-support/', - 'label' : 'Care and support' + text: 'Care and support' }, { 'url' : 'https://www.nhs.uk/pregnancy/', - 'label' : 'Pregnancy' + text: 'Pregnancy' }, { - 'url' : 'https://www.nhs.uk/nhs-services/', - 'label' : 'NHS services' + href: 'https://www.nhs.uk/nhs-services/', + text: 'NHS services' } ] }) }} diff --git a/packages/components/header/README.md b/packages/components/header/README.md index 86b633ded..efdc5d7ee 100644 --- a/packages/components/header/README.md +++ b/packages/components/header/README.md @@ -99,28 +99,28 @@ compiled JavaScript for all components `nhsuk.min.js` or the individual componen "search": true, "primaryLinks": [ { - "url" : "https://www.nhs.uk/conditions", - "label" : "Health A-Z" + href: "https://www.nhs.uk/conditions", + text: "Health A-Z" }, { - 'url' : 'https://www.nhs.uk/live-well/', - 'label' : 'Live Well' + href: 'https://www.nhs.uk/live-well/', + text: 'Live Well' }, { - 'url' : 'https://www.nhs.uk/mental-health/', - 'label' : 'Mental health' + href: 'https://www.nhs.uk/mental-health/', + text: 'Mental health' }, { - 'url' : 'https://www.nhs.uk/conditions/social-care-and-support/', - 'label' : 'Care and support' + href: 'https://www.nhs.uk/conditions/social-care-and-support/', + text: 'Care and support' }, { - 'url' : 'https://www.nhs.uk/pregnancy/', - 'label' : 'Pregnancy' + href: 'https://www.nhs.uk/pregnancy/', + text: 'Pregnancy' }, { - 'url' : 'https://www.nhs.uk/nhs-services/', - 'label' : 'NHS services' + href: 'https://www.nhs.uk/nhs-services/', + text: 'NHS services' } ] }) @@ -198,28 +198,28 @@ compiled JavaScript for all components `nhsuk.min.js` or the individual componen {{ header({ "primaryLinks": [ { - "url" : "https://www.nhs.uk/conditions", - "label" : "Health A-Z" + href: "https://www.nhs.uk/conditions", + text: "Health A-Z" }, { - 'url' : 'https://www.nhs.uk/live-well/', - 'label' : 'Live Well' + href: 'https://www.nhs.uk/live-well/', + text: 'Live Well' }, { - 'url' : 'https://www.nhs.uk/mental-health/', - 'label' : 'Mental health' + href: 'https://www.nhs.uk/mental-health/', + text: 'Mental health' }, { - 'url' : 'https://www.nhs.uk/conditions/social-care-and-support/', - 'label' : 'Care and support' + href: 'https://www.nhs.uk/conditions/social-care-and-support/', + text: 'Care and support' }, { - 'url' : 'https://www.nhs.uk/pregnancy/', - 'label' : 'Pregnancy' + href: 'https://www.nhs.uk/pregnancy/', + text: 'Pregnancy' }, { - 'url' : 'https://www.nhs.uk/nhs-services/', - 'label' : 'NHS services' + href: 'https://www.nhs.uk/nhs-services/', + text: 'NHS services' } ] }) @@ -418,24 +418,24 @@ compiled JavaScript for all components `nhsuk.min.js` or the individual componen }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ] }) @@ -531,24 +531,24 @@ compiled JavaScript for all components `nhsuk.min.js` or the individual componen }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ] }) @@ -644,24 +644,24 @@ compiled JavaScript for all components `nhsuk.min.js` or the individual componen }, "primaryLinks": [ { - "url" : "#", - "label" : "Your hospital visit" + href: "#", + text: "Your hospital visit" }, { - 'url' : '#', - 'label' : 'Wards and departments' + href: '#', + text: 'Wards and departments' }, { - 'url' : '#', - 'label' : 'Conditions and treatments' + href: '#', + text: 'Conditions and treatments' }, { - 'url' : '#', - 'label' : 'Our people' + href: '#', + text: 'Our people' }, { - 'url' : '#', - 'label' : 'Our research' + href: '#', + text: 'Our research' } ] }) @@ -682,8 +682,8 @@ The header Nunjucks macro takes the following arguments: | **organisation.descriptor** | string | No | Organisation descriptor. | | **organisation.logoURL** | string | No | Organisation logo if using a static asset, such as PNG, is preferred. | | **primaryLinks** | array | No | Array of navigation links for use in the header. | -| **primaryLinks[].url** | string | No | The href of a navigation item in the header. | -| **primaryLinks[].label** | string | No | The label of a navigation item in the header. | +| **primaryLinks[].href** | string | No | The href of a navigation item in the header. | +| **primaryLinks[].text** | string | No | The link text of a navigation item in the header. | | **primaryLinks[].classes** | string | No | Optional additional classes to add to the list item. | | **primaryLinks[].attributes** | string | No | Any extra HTML attributes (for example data attributes) to add to the list item. | | **transactionalService** | object | No | Object containing the _name_ and _href_ of the transactional service. | diff --git a/packages/components/header/template.njk b/packages/components/header/template.njk index fc4406547..adcbd0e8b 100644 --- a/packages/components/header/template.njk +++ b/packages/components/header/template.njk @@ -71,7 +71,7 @@