Skip to content

Commit f36ceb3

Browse files
Simplify template logic for header component
1 parent 92bc232 commit f36ceb3

14 files changed

+130
-218
lines changed

app/_templates/page.njk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@
3838
}) }}
3939

4040
{{ header({
41-
"showNav": "false",
42-
"showSearch": "false",
4341
"homeHref": baseUrl
44-
})
45-
}}
42+
}) }}
4643
{% endblock %}
4744

4845

app/components/all.njk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
}) }}
3737

3838
{{ header({
39-
"showNav": "true",
40-
"showSearch": "true",
39+
"search": true,
4140
"primaryLinks": [
4241
{
4342
"url" : "https://www.nhs.uk/conditions",

app/components/header/header-logo.njk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
{% block body %}
77

8-
{{ header({
9-
"showNav": "false",
10-
"showSearch": "false"
11-
})
12-
}}
8+
{{ header() }}
139

1410
{% endblock %}

app/components/header/header-navigation.njk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "true",
10-
"showSearch": "false",
119
"primaryLinks": [
1210
{
1311
"url" : "https://www.nhs.uk/conditions",

app/components/header/header-org-white-nav.njk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "true",
10-
"showSearch": "true",
119
"classes": "nhsuk-header--white nhsuk-header--white-nav",
1210
"organisation": {
1311
"name": "Anytown Anyplace",
@@ -35,7 +33,10 @@
3533
'url' : '#',
3634
'label' : 'Our research'
3735
}
38-
]
36+
],
37+
"search": {
38+
"visuallyHiddenLabel": "Search the Anytown Anyplace Anywhere website"
39+
}
3940
})
4041
}}
4142

app/components/header/header-org-white.njk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "true",
10-
"showSearch": "true",
119
"classes": "nhsuk-header--white",
1210
"organisation": {
1311
"name": "Anytown Anyplace",
@@ -35,7 +33,10 @@
3533
'url' : '#',
3634
'label' : 'Our research'
3735
}
38-
]
36+
],
37+
"search": {
38+
"visuallyHiddenLabel": "Search the Anytown Anyplace Anywhere website"
39+
}
3940
})
4041
}}
4142

app/components/header/header-org.njk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "true",
10-
"showSearch": "true",
119
"organisation": {
1210
"name": "Anytown Anyplace",
1311
"split": "Anywhere",
@@ -34,7 +32,10 @@
3432
'url' : '#',
3533
'label' : 'Our research'
3634
}
37-
]
35+
],
36+
"search": {
37+
"visuallyHiddenLabel": "Search the Anytown Anyplace Anywhere website"
38+
}
3839
})
3940
}}
4041

app/components/header/header-search.njk

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,7 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "false",
10-
"showSearch": "true",
11-
"primaryLinks": [
12-
{
13-
"url" : "https://www.nhs.uk/conditions",
14-
"label" : "Health A-Z"
15-
},
16-
{
17-
'url' : 'https://www.nhs.uk/live-well/',
18-
'label' : 'Live Well'
19-
},
20-
{
21-
'url' : 'https://www.nhs.uk/mental-health/',
22-
'label' : 'Mental health'
23-
},
24-
{
25-
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
26-
'label' : 'Care and support'
27-
},
28-
{
29-
'url' : 'https://www.nhs.uk/pregnancy/',
30-
'label' : 'Pregnancy'
31-
},
32-
{
33-
'url' : 'https://www.nhs.uk/nhs-services/',
34-
'label' : 'NHS services'
35-
}
36-
]
37-
})
38-
}}
9+
"search": true
10+
}) }}
3911

4012
{% endblock %}

app/components/header/header-service-name-with-nav.njk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
"service": {
1010
"name": "Digital service manual"
1111
},
12-
"showNav": "true",
13-
"showSearch": "true",
12+
"search": {
13+
"visuallyHiddenLabel": "Search the NHS digital service manual"
14+
},
1415
"primaryLinks": [
1516
{
1617
"url" : "#",

app/components/header/header-service-name.njk

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
{% block body %}
77

88
{{ header({
9-
"service": {
10-
"name": "Prototype kit"
11-
}
12-
})
13-
}}
9+
"service": {
10+
"name": "Prototype kit"
11+
}
12+
}) }}
1413

1514
{% endblock %}

app/components/header/header-transactional-service-name.njk

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
{% block body %}
77

88
{{ header({
9-
"transactionalService": {
10-
"name": "Find your NHS number"
11-
},
12-
"showNav": "false",
13-
"showSearch": "false"
14-
})
15-
}}
9+
"transactionalService": {
10+
"name": "Find your NHS number"
11+
}
12+
}) }}
1613

1714
{% endblock %}

app/components/header/index.njk

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,33 @@
66
{% block body %}
77

88
{{ header({
9-
"showNav": "true",
10-
"showSearch": "true",
11-
"primaryLinks": [
12-
{
13-
"url" : "https://www.nhs.uk/conditions",
14-
"label" : "Health A-Z"
15-
},
16-
{
17-
'url' : 'https://www.nhs.uk/live-well/',
18-
'label' : 'Live Well'
19-
},
20-
{
21-
'url' : 'https://www.nhs.uk/mental-health/',
22-
'label' : 'Mental health'
23-
},
24-
{
25-
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
26-
'label' : 'Care and support'
27-
},
28-
{
29-
'url' : 'https://www.nhs.uk/pregnancy/',
30-
'label' : 'Pregnancy'
31-
},
32-
{
33-
'url' : 'https://www.nhs.uk/nhs-services/',
34-
'label' : 'NHS services'
35-
}
36-
]
37-
})
38-
}}
9+
"search": true,
10+
"primaryLinks": [
11+
{
12+
"url" : "https://www.nhs.uk/conditions",
13+
"label" : "Health A-Z"
14+
},
15+
{
16+
'url' : 'https://www.nhs.uk/live-well/',
17+
'label' : 'Live Well'
18+
},
19+
{
20+
'url' : 'https://www.nhs.uk/mental-health/',
21+
'label' : 'Mental health'
22+
},
23+
{
24+
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
25+
'label' : 'Care and support'
26+
},
27+
{
28+
'url' : 'https://www.nhs.uk/pregnancy/',
29+
'label' : 'Pregnancy'
30+
},
31+
{
32+
'url' : 'https://www.nhs.uk/nhs-services/',
33+
'label' : 'NHS services'
34+
}
35+
]
36+
}) }}
3937

4038
{% endblock %}

0 commit comments

Comments
 (0)