Skip to content

Commit

Permalink
Simplify template logic for header component
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Aug 19, 2024
1 parent 7118439 commit 727bcc4
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 238 deletions.
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 %}
63 changes: 30 additions & 33 deletions app/components/header/header-navigation.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,36 @@
{% block body %}

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

{% endblock %}
7 changes: 4 additions & 3 deletions app/components/header/header-org-white-nav.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{% block body %}

{{ header({
"showNav": "true",
"showSearch": "true",
"classes": "nhsuk-header--white nhsuk-header--white-nav",
"organisation": {
"name": "Anytown Anyplace",
Expand Down Expand Up @@ -35,7 +33,10 @@
'url' : '#',
'label' : 'Our research'
}
]
],
"search": {
"label": "Search the Anytown Anyplace Anywhere website"
}
})
}}

Expand Down
7 changes: 4 additions & 3 deletions app/components/header/header-org-white.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{% block body %}

{{ header({
"showNav": "true",
"showSearch": "true",
"classes": "nhsuk-header--white",
"organisation": {
"name": "Anytown Anyplace",
Expand Down Expand Up @@ -35,7 +33,10 @@
'url' : '#',
'label' : 'Our research'
}
]
],
"search": {
"label": "Search the Anytown Anyplace Anywhere website"
}
})
}}

Expand Down
7 changes: 4 additions & 3 deletions app/components/header/header-org.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{% block body %}

{{ header({
"showNav": "true",
"showSearch": "true",
"organisation": {
"name": "Anytown Anyplace",
"split": "Anywhere",
Expand All @@ -34,7 +32,10 @@
'url' : '#',
'label' : 'Our research'
}
]
],
"search": {
"label": "Search the Anytown Anyplace Anywhere website"
}
})
}}

Expand Down
32 changes: 2 additions & 30 deletions app/components/header/header-search.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,7 @@
{% block body %}

{{ header({
"showNav": "false",
"showSearch": "true",
"primaryLinks": [
{
"url" : "https://www.nhs.uk/conditions",
"label" : "Health A-Z"
},
{
'url' : 'https://www.nhs.uk/live-well/',
'label' : 'Live Well'
},
{
'url' : 'https://www.nhs.uk/mental-health/',
'label' : 'Mental health'
},
{
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
'label' : 'Care and support'
},
{
'url' : 'https://www.nhs.uk/pregnancy/',
'label' : 'Pregnancy'
},
{
'url' : 'https://www.nhs.uk/nhs-services/',
'label' : 'NHS services'
}
]
})
}}
"search": "true"
}) }}

{% endblock %}
5 changes: 3 additions & 2 deletions app/components/header/header-service-name-with-nav.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"service": {
"name": "Digital service manual"
},
"showNav": "true",
"showSearch": "true",
"search": {
"label": "Search the NHS digital service manual"
},
"primaryLinks": [
{
"url" : "#",
Expand Down
9 changes: 4 additions & 5 deletions app/components/header/header-service-name.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
{% block body %}

{{ header({
"service": {
"name": "Prototype kit"
}
})
}}
"service": {
"name": "Prototype kit"
}
}) }}

{% endblock %}
11 changes: 4 additions & 7 deletions app/components/header/header-transactional-service-name.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
{% block body %}

{{ header({
"transactionalService": {
"name": "Find your NHS number"
},
"showNav": "false",
"showSearch": "false"
})
}}
"transactionalService": {
"name": "Find your NHS number"
}
}) }}

{% endblock %}
Loading

0 comments on commit 727bcc4

Please sign in to comment.