Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header updates - breaking changes #1058

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fd5d82e
Remove hardcoded Home link from navigation
frankieroberto Jul 17, 2024
1d564ed
Add 'Home' to examples
frankieroberto Jul 17, 2024
010afb0
Use single path for NHS logo in header
paulrobertlloyd Oct 9, 2024
f24cdf3
Update CHANGELOG with updated SVG logo
paulrobertlloyd Oct 9, 2024
95d5aa6
Update SVG in README for header component
paulrobertlloyd Oct 9, 2024
8499270
Format header styles with Prettier
paulrobertlloyd Oct 9, 2024
f4c1c93
Simplify template logic for header component
paulrobertlloyd Aug 19, 2024
9c192c7
Allow transactional service name in header alongside navigation and s…
paulrobertlloyd Aug 20, 2024
4fc2b53
Update CHANGELOG.md
paulrobertlloyd Aug 22, 2024
611c2ef
Ensure logo in header appears for print media
paulrobertlloyd Oct 24, 2024
82b4b41
Refactor header styles
paulrobertlloyd Oct 24, 2024
e45d809
Update header README to account for recent markup changes
paulrobertlloyd Oct 24, 2024
64afec5
Update backstop reference images for header component
paulrobertlloyd Oct 24, 2024
a1ee8c1
Remove home link from header navigation
paulrobertlloyd Oct 31, 2024
230bf09
Change primaryLinks to use href and text instead of url and label (#1…
frankieroberto Nov 29, 2024
51b1929
Fix changelog merge
frankieroberto Nov 29, 2024
7b55d10
Fix CHANGELOG
frankieroberto Nov 29, 2024
9c49e84
Actually fix changelog
frankieroberto Nov 29, 2024
d17095e
Add changelog item
frankieroberto Nov 29, 2024
46854f9
Merge branch 'main' into header-breaking-changes
frankieroberto Dec 18, 2024
53a7e11
Add current item indicator for header navigation (#1067)
frankieroberto Jan 9, 2025
2097188
Describe the active and current arguments in header (#1098)
frankieroberto Jan 13, 2025
9982244
Update header navigation label (#1073)
paulrobertlloyd Jan 13, 2025
00fe295
Show account information and links in the header (#1063)
paulrobertlloyd Jan 13, 2025
457f00c
tidy header examples
anandamaryon1 Jan 14, 2025
1a2e12b
run prettier on header README
anandamaryon1 Jan 14, 2025
b746e73
Update backstop refernece images
anandamaryon1 Jan 14, 2025
9fc5b2e
Merge branch 'main' into header-breaking-changes
frankieroberto Jan 14, 2025
ed69c88
update changelog
anandamaryon1 Jan 20, 2025
3f60fff
edit account header rbac example placeholder
anandamaryon1 Jan 28, 2025
3310b1e
Merge branch 'main' into header-breaking-changes
frankieroberto Jan 30, 2025
e8fd520
Enable inline styles in tests
frankieroberto Jan 31, 2025
9b32d44
Style fix
frankieroberto Jan 31, 2025
0dfb446
Merge branch 'main' into header-breaking-changes
colinrotherham Feb 13, 2025
c2a1539
Fix Stylelint issues
colinrotherham Feb 13, 2025
a57b40f
Approve minor changes to backstop images
frankieroberto Feb 17, 2025
5713bb3
Merge branch 'main' into header-breaking-changes
colinrotherham Feb 22, 2025
150fea0
Add layout blocks from GOV.UK Frontend
colinrotherham Feb 22, 2025
9b4f3e2
Fix HTML validation moving `<style>` to head
colinrotherham Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:new: **New features**

- Output source maps and use minified code in examples ([PR 1152](https://github.com/nhsuk/nhsuk-frontend/pull/1152))
- The primary navigation in the header now lets you show which item is the current section or page. ([PR 1067](https://github.com/nhsuk/nhsuk-frontend/pull/1067))

:wrench: **Fixes**

Expand All @@ -19,6 +20,48 @@ We've configured our build tasks to use [Browserslist](https://browsersl.ist) fo
We've made fixes to NHS.UK frontend in the following pull requests:

- [#1148: Fix Tabs component in Safari < 14 and Internet Explorer 11](https://github.com/nhsuk/nhsuk-frontend/pull/1148)
- Fix appearance of the select element for more consistency between browsers and OS ([Issue 527](https://github.com/nhsuk/nhsuk-service-manual-community-backlog/issues/527))
- Fix appearance of disabled warning buttons ([Issue 1034]([https://github.com/nhsuk/nhsuk-service-manual-community-backlog/issues/1034]))
- Fix reverse button text colour ([PR 1080]([https://github.com/nhsuk/nhsuk-frontend/pull/1080]))
- Fix details component requiring html param in uppercase ([PR 1090](https://github.com/nhsuk/nhsuk-frontend/pull/1090), [Issue 1089](https://github.com/nhsuk/nhsuk-frontend/issues/1089))
- Update header navigation label from ’Primary navigation’ to ‘Menu’, and remove superfluous `role` and `id` attributes. ([PR 1073](https://github.com/nhsuk/nhsuk-frontend/pull/1073)) To update your HTML, replace:

```html
<nav class="nhsuk-navigation" id="header-navigation" role="navigation" aria-label="Primary navigation">
```

with

```html
<nav class="nhsuk-navigation" aria-label="Menu">
```

:boom: **Breaking changes**

- Remove the boolean `showNav`, `showSearch` and `transactional` options from the header component. Respective parts of the header are now shown if values for `primaryLinks`, `search` or `transactionalService` options are provided. Additionally, the `searchAction` option is renamed `search.action` and the `searchInputName` option is renamed `search.name`. Finally, the label, button and placeholder text for the search input can be updated using the new `search.visuallyHiddenLabel`, `search.visuallyHiddenButton` and `search.placeholder` options. ([PR 996](https://github.com/nhsuk/nhsuk-frontend/pull/996))

- Update `primaryLinks` in the header to use `text` and `href` instead of `label` and `url` ([PR 1083](https://github.com/nhsuk/nhsuk-frontend/pull/1083))

- Update NHS logo in the header so that it has higher contrast when focused. ([PR 1047]([https://github.com/nhsuk/nhsuk-frontend/pull/1047]))

Previously the logo used the following SVG:

```svg
<svg class="nhsuk-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 16" height="40" width="100">
<path class="nhsuk-logo__background" fill="#005eb8" d="M0 0h40v16H0z"></path>
<path class="nhsuk-logo__text" fill="#fff" d="M3.9 1.5h4.4l2.6 9h.1l1.8-9h3.3l-2.8 13H9l-2.7-9h-.1l-1.8 9H1.1M17.3 1.5h3.6l-1 4.9h4L25 1.5h3.5l-2.7 13h-3.5l1.1-5.6h-4.1l-1.2 5.6h-3.4M37.7 4.4c-.7-.3-1.6-.6-2.9-.6-1.4 0-2.5.2-2.5 1.3 0 1.8 5.1 1.2 5.1 5.1 0 3.6-3.3 4.5-6.4 4.5-1.3 0-2.9-.3-4-.7l.8-2.7c.7.4 2.1.7 3.2.7s2.8-.2 2.8-1.5c0-2.1-5.1-1.3-5.1-5 0-3.4 2.9-4.4 5.8-4.4 1.6 0 3.1.2 4 .6"></path>
</svg>
```

This has been updated to use the following SVG:

```svg
<svg class="nhsuk-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" height="40" width="100">
<path fill="currentcolor" 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"/>
</svg>
```

- Remove hardcoded home link from navigation ([PR 986](https://github.com/nhsuk/nhsuk-frontend/pull/986))

## 9.3.0 - 13 February 2025

Expand Down
33 changes: 20 additions & 13 deletions app/_templates/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@

<script src="{{ baseUrl }}javascripts/nhsuk-{{ version }}.min.js" defer></script>

<link rel="shortcut icon" href="{{ baseUrl }}assets/favicons/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ baseUrl }}assets/favicons/apple-touch-icon-180x180.png">
<link rel="mask-icon" href="{{ baseUrl }}assets/favicon.svg" color="#005eb8">
<link rel="icon" sizes="192x192" href="{{ baseUrl }}assets/favicon-192x192.png">
<meta name="msapplication-TileImage" content="{{ baseUrl }}assets/mediumtile-144x144.png">
<meta name="msapplication-TileColor" content="#005eb8">
<meta name="msapplication-square70x70logo" content="{{ baseUrl }}assets/smalltile-70x70.png">
<meta name="msapplication-square150x150logo" content="{{ baseUrl }}assets/mediumtile-150x150.png">
<meta name="msapplication-wide310x150logo" content="{{ baseUrl }}assets/favicons/widetile-310x150.png">
<meta name="msapplication-square310x310logo" content="{{ baseUrl }}assets/favicons/largetile-310x310.png">
{% block headIcons %}
<link rel="shortcut icon" href="{{ baseUrl }}assets/favicons/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ baseUrl }}assets/favicons/apple-touch-icon-180x180.png">
<link rel="mask-icon" href="{{ baseUrl }}assets/favicon.svg" color="#005eb8">
<link rel="icon" sizes="192x192" href="{{ baseUrl }}assets/favicon-192x192.png">
<meta name="msapplication-TileImage" content="{{ baseUrl }}assets/mediumtile-144x144.png">
<meta name="msapplication-TileColor" content="#005eb8">
<meta name="msapplication-square70x70logo" content="{{ baseUrl }}assets/smalltile-70x70.png">
<meta name="msapplication-square150x150logo" content="{{ baseUrl }}assets/mediumtile-150x150.png">
<meta name="msapplication-wide310x150logo" content="{{ baseUrl }}assets/favicons/widetile-310x150.png">
<meta name="msapplication-square310x310logo" content="{{ baseUrl }}assets/favicons/largetile-310x310.png">
{% endblock %}

{% block head %}{% endblock %}

<meta property="og:url" content="https://nhsuk.github.io/nhsuk-frontend/">
<meta property="og:title" content="NHS.UK frontend library">
Expand All @@ -46,11 +50,14 @@

<body class="{{ body_class }}">
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
{% block bodyStart %}{% endblock %}

{% block header %}{% endblock %}
{% block header %}{% endblock %}

{% block body %}{% endblock %}
{% block body %}{% endblock %}

{% block footer %}{% endblock %}
{% block footer %}{% endblock %}

{% block bodyEnd %}{% endblock %}
</body>
</html>
5 changes: 1 addition & 4 deletions app/_templates/page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@
}) }}

{{ header({
"showNav": "false",
"showSearch": "false",
"homeHref": baseUrl
})
}}
}) }}
{% endblock %}


Expand Down
23 changes: 11 additions & 12 deletions app/components/all.njk
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,27 @@
}) }}

{{ header({
"showNav": "true",
"showSearch": "true",
"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'
}
]
})
Expand Down
46 changes: 46 additions & 0 deletions app/components/header/header-account-custom-html.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% set html_style = "background-color: #f0f4f5;" %}
{% set title = "Header with account (logged in, custom html)" %}
{% from "components/header/macro.njk" import header %}
{% extends "layout.njk" %}

{% block head %}
<style>
.app-count {
align-self: center;
align-items: center;
background-color: #d5281b;
border-radius: 1em;
color: #fff;
font-size: 14px;
height: 1.5em;
line-height: 1.5em;
min-width: 1.5em;
padding: 0.25em;
display: inline-flex;
justify-content: center;
}
</style>
{% endblock %}

{% block body %}
{{ header({
account: {
items: [
{
href: "#",
text: "Check your profile"
},
{
html: '<a class="nhsuk-header__account-link" href="#">Notifications</a> <span class="app-count">8</span>'
},
{
href: "#",
text: "Log out"
}
]
},
service: {
name: "Profile manager"
}
}) }}
{% endblock %}
46 changes: 46 additions & 0 deletions app/components/header/header-account-logged-in.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% set html_style = "background-color: #f0f4f5;" %}
{% set title = "Header with account (logged in)" %}
{% from "components/header/macro.njk" import header %}
{% extends "layout.njk" %}

{% block body %}
{{ header({
service: {
name: "Manage patients"
},
account: {
items: [
{
href: "#",
text: "[email protected]",
icon: true
},
{
href: "#",
text: "Log out"
}
]
},
primaryLinks: [
{
href: "#",
text: "Home"
},
{
href: "#",
text: "Services"
},
{
href: "#",
text: "Your health"
},
{
href: "#",
text: "Messages"
}, {
href: "#",
text: "Help and support"
}
]
}) }}
{% endblock %}
20 changes: 20 additions & 0 deletions app/components/header/header-account-logged-out.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% set html_style = "background-color: #f0f4f5;" %}
{% set title = "Header with account (logged out)" %}
{% from "components/header/macro.njk" import header %}
{% extends "layout.njk" %}

{% block body %}
{{ header({
service: {
name: "Manage patients"
},
account: {
items: [
{
href: "#",
text: "Log in"
}
]
}
}) }}
{% endblock %}
50 changes: 50 additions & 0 deletions app/components/header/header-account-rbac.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% set html_style = "background-color: #f0f4f5;" %}
{% set title = "Header with account (logged in, RBAC)" %}
{% from "components/header/macro.njk" import header %}
{% extends "layout.njk" %}

{% block body %}
{{ header({
service: {
name: "Manage patients"
},
search: {
placeholder: "NHS number, Date of birth",
visuallyHiddenLabel: "Search for a user"
},
account: {
items: [
{
href: "#",
text: "Florence Nightingale",
icon: true
},
{
text: "RA Manager, Hull and East Yorkshire Hospitals NHS Trust (RWA)"
},
{
href: "#",
text: "Change role"
},
{
href: "#",
text: "Log out"
}
]
},
primaryLinks: [
{
href: "#",
text: "Home"
},
{
href: "#",
text: "Create user"
},
{
href: "#",
text: "Find user"
}
]
}) }}
{% endblock %}
6 changes: 1 addition & 5 deletions app/components/header/header-logo.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

{% block body %}

{{ header({
"showNav": "false",
"showSearch": "false"
})
}}
{{ header() }}

{% endblock %}
33 changes: 14 additions & 19 deletions app/components/header/header-navigation.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,31 @@
{% block body %}

{{ header({
"showNav": "true",
"showSearch": "false",
"primaryLinks": [
primaryLinks: [
{
"url" : "https://www.nhs.uk/conditions",
"label" : "Health A-Z",
"classes": "app-header__navigation-item--current",
"attributes": {
"aria-current": "true"
}
href: "#",
text: "Health A-Z"
},
{
'url' : 'https://www.nhs.uk/live-well/',
'label' : 'Live Well'
href: "#",
text: "Live Well"
},
{
'url' : 'https://www.nhs.uk/mental-health/',
'label' : 'Mental health'
href: "#",
text: "Mental health"
},
{
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
'label' : 'Care and support'
href: "#",
text: "Care and support",
active: true
},
{
'url' : 'https://www.nhs.uk/pregnancy/',
'label' : 'Pregnancy'
href: "#",
text: "Pregnancy"
},
{
'url' : 'https://www.nhs.uk/nhs-services/',
'label' : 'NHS services'
href: "#",
text: "NHS services"
}
]
})
Expand Down
Loading
Loading