@ons/design-system 59.0.0 → 60.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/access-code/uac.scss +1 -1
- package/components/autosuggest/_autosuggest.scss +1 -1
- package/components/button/_button.scss +3 -3
- package/components/download-resources/_download-resources.scss +1 -1
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/footer/_footer.scss +0 -15
- package/components/footer/_macro.njk +62 -103
- package/components/footer/_macro.spec.js +56 -186
- package/components/header/_header.scss +23 -25
- package/components/header/_macro.njk +133 -148
- package/components/header/_macro.spec.js +39 -73
- package/components/hero/_hero.scss +4 -0
- package/components/hero/_macro.njk +35 -92
- package/components/hero/_macro.spec.js +54 -190
- package/components/icons/_macro.njk +0 -499
- package/components/icons/_macro.spec.js +0 -14
- package/components/navigation/_macro.njk +14 -14
- package/components/navigation/_macro.spec.js +3 -5
- package/components/navigation/_navigation.scss +4 -4
- package/components/panel/_panel.scss +1 -1
- package/components/summary/_summary.scss +2 -2
- package/components/table/_table.scss +3 -3
- package/css/main.css +3 -3
- package/fonts/opensans-bold.woff +0 -0
- package/fonts/opensans-bold.woff2 +0 -0
- package/fonts/opensans-regular.woff +0 -0
- package/fonts/opensans-regular.woff2 +0 -0
- package/img/large/placeholder-card.png +0 -0
- package/img/large/placeholder-news-medium.png +0 -0
- package/img/large/placeholder-news.png +0 -0
- package/img/large/placeholder-portrait.png +0 -0
- package/img/small/placeholder-card.png +0 -0
- package/img/small/placeholder-news-medium.png +0 -0
- package/img/small/placeholder-news.png +0 -0
- package/img/small/placeholder-portrait.png +0 -0
- package/js/main.js +0 -1
- package/layout/_template.njk +51 -62
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_typography.scss +1 -0
- package/scss/main.scss +0 -2
- package/scss/patternlib.scss +2 -1
- package/scss/utilities/_typography.scss +1 -1
- package/scss/vars/_colors.scss +9 -4
- package/scss/vars/_typography.scss +1 -1
- package/components/find-a-support-centre/_find-a-support-centre.scss +0 -9
- package/components/promotional-banner/_macro.njk +0 -49
- package/components/promotional-banner/_macro.spec.js +0 -97
- package/components/promotional-banner/_promo-banner.scss +0 -72
- package/components/select/select.js +0 -19
- package/components/select/select.spec.js +0 -56
- package/css/census.css +0 -243
- package/css/ids.css +0 -243
- package/favicons/browserconfig.xml +0 -12
- package/favicons/census/cy/android-chrome-192x192.png +0 -0
- package/favicons/census/cy/android-chrome-512x512.png +0 -0
- package/favicons/census/cy/apple-touch-icon.png +0 -0
- package/favicons/census/cy/browserconfig.xml +0 -12
- package/favicons/census/cy/favicon-16x16.png +0 -0
- package/favicons/census/cy/favicon-32x32.png +0 -0
- package/favicons/census/cy/favicon.ico +0 -0
- package/favicons/census/cy/manifest.json +0 -20
- package/favicons/census/cy/mstitle-150x150.png +0 -0
- package/favicons/census/cy/mstitle-310x150.png +0 -0
- package/favicons/census/cy/mstitle-310x310.png +0 -0
- package/favicons/census/cy/mstitle-70x70.png +0 -0
- package/favicons/census/cy/opengraph.png +0 -0
- package/favicons/census/cy/safari-pinned-tab.svg +0 -3
- package/favicons/census/cy/site.webmanifest +0 -19
- package/favicons/census/cy/twitter.png +0 -0
- package/favicons/census/en/android-chrome-192x192.png +0 -0
- package/favicons/census/en/android-chrome-512x512.png +0 -0
- package/favicons/census/en/apple-touch-icon.png +0 -0
- package/favicons/census/en/browserconfig.xml +0 -12
- package/favicons/census/en/favicon-16x16.png +0 -0
- package/favicons/census/en/favicon-32x32.png +0 -0
- package/favicons/census/en/favicon.ico +0 -0
- package/favicons/census/en/manifest.json +0 -20
- package/favicons/census/en/mstitle-150x150.png +0 -0
- package/favicons/census/en/mstitle-310x150.png +0 -0
- package/favicons/census/en/mstitle-310x310.png +0 -0
- package/favicons/census/en/mstitle-70x70.png +0 -0
- package/favicons/census/en/opengraph.png +0 -0
- package/favicons/census/en/safari-pinned-tab.svg +0 -3
- package/favicons/census/en/site.webmanifest +0 -19
- package/favicons/census/en/twitter.png +0 -0
- package/favicons/census/ni/favicon.ico +0 -0
- package/favicons/ids/cy/android-chrome-192x192.png +0 -0
- package/favicons/ids/cy/android-chrome-512x512.png +0 -0
- package/favicons/ids/cy/apple-touch-icon.png +0 -0
- package/favicons/ids/cy/browserconfig.xml +0 -12
- package/favicons/ids/cy/favicon-16x16.png +0 -0
- package/favicons/ids/cy/favicon-32x32.png +0 -0
- package/favicons/ids/cy/favicon.ico +0 -0
- package/favicons/ids/cy/manifest.json +0 -20
- package/favicons/ids/cy/mstile-150x150.png +0 -0
- package/favicons/ids/cy/mstile-310x150.png +0 -0
- package/favicons/ids/cy/mstile-310x310.png +0 -0
- package/favicons/ids/cy/mstile-70x70.png +0 -0
- package/favicons/ids/cy/opengraph.png +0 -0
- package/favicons/ids/cy/safari-pinned-tab.svg +0 -27
- package/favicons/ids/cy/site.webmanifest +0 -54
- package/favicons/ids/cy/twitter.png +0 -0
- package/favicons/ids/en/android-chrome-192x192.png +0 -0
- package/favicons/ids/en/android-chrome-512x512.png +0 -0
- package/favicons/ids/en/apple-touch-icon.png +0 -0
- package/favicons/ids/en/browserconfig.xml +0 -12
- package/favicons/ids/en/favicon-16x16.png +0 -0
- package/favicons/ids/en/favicon-32x32.png +0 -0
- package/favicons/ids/en/favicon.ico +0 -0
- package/favicons/ids/en/manifest.json +0 -20
- package/favicons/ids/en/mstile-150x150.png +0 -0
- package/favicons/ids/en/mstile-310x150.png +0 -0
- package/favicons/ids/en/mstile-310x310.png +0 -0
- package/favicons/ids/en/mstile-70x70.png +0 -0
- package/favicons/ids/en/opengraph.png +0 -0
- package/favicons/ids/en/safari-pinned-tab.svg +0 -27
- package/favicons/ids/en/site.webmanifest +0 -54
- package/favicons/ids/en/twitter.png +0 -0
- package/favicons/mstitle-150x150.png +0 -0
- package/favicons/mstitle-310x150.png +0 -0
- package/favicons/mstitle-310x310.png +0 -0
- package/favicons/mstitle-70x70.png +0 -0
- package/img/UKOpenGovernmentLicence-grey.svg +0 -4
- package/img/UKOpenGovernmentLicence.svg +0 -13
- package/img/card-placeholder.svg +0 -14
- package/img/census-landscape.svg +0 -4514
- package/img/census-logo-stacked-pos-billingual.png +0 -0
- package/img/census-logo-stacked-pos-cy.png +0 -0
- package/img/census-logo-stacked-pos-en.png +0 -0
- package/img/census-promo-banner.svg +0 -489
- package/img/circle-lines.svg +0 -31
- package/img/dummy-brand-logo.svg +0 -6
- package/img/icons--check.svg +0 -3
- package/img/icons--chevron-down.svg +0 -3
- package/img/its-about-us--dark.svg +0 -4
- package/img/its-about-us--light.svg +0 -4
- package/img/large/hero-man.png +0 -0
- package/img/logo.svg +0 -77
- package/img/ni-syn-cyfrif--dark.svg +0 -3
- package/img/ni-syn-cyfrif--light.svg +0 -3
- package/img/nisra-logo-black-en.svg +0 -4
- package/img/ogl.svg +0 -10
- package/img/ons-logo-black-cy.svg +0 -4
- package/img/ons-logo-black-en.svg +0 -4
- package/img/people-mob.png +0 -0
- package/img/people.png +0 -0
- package/img/rehearsal-areas.svg +0 -11
- package/img/small/hero-man.png +0 -0
- package/scss/census.scss +0 -2
- package/scss/ids.scss +0 -2
- package/scss/settings/_census.scss +0 -159
- package/scss/settings/_ids.scss +0 -52
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
width: 100%;
|
|
13
13
|
}
|
|
14
14
|
&__grid-top {
|
|
15
|
-
|
|
15
|
+
padding: 1rem 0;
|
|
16
16
|
|
|
17
17
|
@include mq(xs) {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
&__grid-top-tall {
|
|
22
|
-
@include mq(xs) {
|
|
23
|
-
height: 76px;
|
|
18
|
+
padding: 0.75rem 0;
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
&__main {
|
|
@@ -114,20 +109,29 @@
|
|
|
114
109
|
|
|
115
110
|
&--neutral & {
|
|
116
111
|
&__top {
|
|
117
|
-
background: var(--ons-color-header-masthead-
|
|
112
|
+
background: var(--ons-color-header-masthead-neutral);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&__grid-top {
|
|
116
|
+
a {
|
|
117
|
+
color: var(--ons-color-service-links);
|
|
118
|
+
&:hover {
|
|
119
|
+
text-decoration: underline solid var(--ons-color-service-links) 3px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
&__main {
|
|
121
|
-
background: var(--ons-color-header-
|
|
125
|
+
background: var(--ons-color-header-neutral);
|
|
122
126
|
|
|
123
127
|
&--border {
|
|
124
|
-
border-bottom: 3px solid var(--ons-color-header-
|
|
125
|
-
border-top: 3px solid var(--ons-color-header-
|
|
128
|
+
border-bottom: 3px solid var(--ons-color-header-neutral);
|
|
129
|
+
border-top: 3px solid var(--ons-color-header-neutral);
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
&__title {
|
|
130
|
-
color: var(--ons-color-
|
|
134
|
+
color: var(--ons-color-header-title);
|
|
131
135
|
&-link {
|
|
132
136
|
&:hover {
|
|
133
137
|
text-decoration: underline solid var(--ons-color-branded-text) 2px;
|
|
@@ -143,6 +147,13 @@
|
|
|
143
147
|
&__org-logo-link,
|
|
144
148
|
&__title-logo-link {
|
|
145
149
|
display: block;
|
|
150
|
+
font-size: 0;
|
|
151
|
+
&:hover {
|
|
152
|
+
text-decoration: none;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&__org-logo-link {
|
|
146
157
|
&:focus {
|
|
147
158
|
.ons-svg-logo {
|
|
148
159
|
fill: var(--ons-color-black) !important;
|
|
@@ -151,19 +162,6 @@
|
|
|
151
162
|
}
|
|
152
163
|
}
|
|
153
164
|
}
|
|
154
|
-
&:hover {
|
|
155
|
-
font-size: 0;
|
|
156
|
-
text-decoration: none;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
&__title-logo--large {
|
|
161
|
-
.ons-svg-logo {
|
|
162
|
-
@include mq(xxs, 399px) {
|
|
163
|
-
height: auto;
|
|
164
|
-
max-width: 160px;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
165
|
}
|
|
168
166
|
|
|
169
167
|
&__org-logo--large {
|
|
@@ -30,175 +30,168 @@
|
|
|
30
30
|
"html": params.phase.html
|
|
31
31
|
}) }}
|
|
32
32
|
{% endif %}
|
|
33
|
-
|
|
34
|
-
<div class="ons-
|
|
35
|
-
<div class="ons-
|
|
36
|
-
<div class="ons-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
<div class="ons-header__top">
|
|
34
|
+
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
35
|
+
<div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{% if params.mastheadLogo.classes %} {{ params.mastheadLogo.classes }}{% endif %}">
|
|
36
|
+
<div class="ons-grid__col ons-col-auto">
|
|
37
|
+
{%-if params.mastheadLogoUrl %}
|
|
38
|
+
<a class="ons-header__org-logo-link" href="{{ params.mastheadLogoUrl }}">
|
|
39
|
+
{% endif -%}
|
|
40
|
+
<div class="ons-header__org-logo ons-header__org-logo--large">
|
|
41
|
+
{% if params.mastheadLogo.large %}
|
|
42
|
+
{{ params.mastheadLogo.large | safe }}
|
|
43
|
+
{% else %}
|
|
43
44
|
{{
|
|
44
45
|
onsIcon({
|
|
45
|
-
"iconType":
|
|
46
|
-
"altText":
|
|
46
|
+
"iconType": 'ons-logo-' + currentLanguageISOCode,
|
|
47
|
+
"altText": 'Office for National Statistics logo'
|
|
47
48
|
})
|
|
48
49
|
}}
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
{% endif %}
|
|
51
|
+
</div>
|
|
52
|
+
<div class="ons-header__org-logo ons-header__org-logo--small">
|
|
53
|
+
{% if params.mastheadLogo.small or params.mastheadLogo.large %}
|
|
54
|
+
{{ params.mastheadLogo.small | safe }}
|
|
55
|
+
{% else %}
|
|
51
56
|
{{
|
|
52
57
|
onsIcon({
|
|
53
|
-
"iconType":
|
|
54
|
-
"altText":
|
|
58
|
+
"iconType": 'ons-logo-stacked-' + currentLanguageISOCode,
|
|
59
|
+
"altText": 'Office for National Statistics logo'
|
|
55
60
|
})
|
|
56
61
|
}}
|
|
57
|
-
</div>
|
|
58
|
-
{% if params.orgLogoHref %}
|
|
59
|
-
</a>
|
|
60
62
|
{% endif %}
|
|
61
63
|
</div>
|
|
62
|
-
{% if params.
|
|
63
|
-
|
|
64
|
-
{% if params.language %}
|
|
65
|
-
<div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks else '' }}">
|
|
66
|
-
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
67
|
-
{{ onsLanguageSelector(params.language) }}
|
|
68
|
-
</div>
|
|
69
|
-
{% endif %}
|
|
70
|
-
{% if params.serviceLinks %}
|
|
71
|
-
{% if params.serviceLinks.itemsList | length == 1 and params.language %}
|
|
72
|
-
{% set breakpoint = 'xs' %}
|
|
73
|
-
{% set controlVisibility = true %}
|
|
74
|
-
{% elif params.serviceLinks.itemsList | length > 1 %}
|
|
75
|
-
{% set breakpoint = 'm' %}
|
|
76
|
-
{% set controlVisibility = true %}
|
|
77
|
-
{% else %}
|
|
78
|
-
{% set controlVisibility = false %}
|
|
79
|
-
{% endif %}
|
|
80
|
-
<div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
|
|
81
|
-
<nav class="ons-header-service-nav ons-header-service-nav--main {{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
82
|
-
<ul class="ons-header-service-nav__list">
|
|
83
|
-
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
84
|
-
<li class="ons-header-service-nav__item">
|
|
85
|
-
{% if item.iconType %}
|
|
86
|
-
{{
|
|
87
|
-
onsIcon({
|
|
88
|
-
"iconType": item.iconType
|
|
89
|
-
})
|
|
90
|
-
}}
|
|
91
|
-
{% endif %}
|
|
92
|
-
{% if item.url %}
|
|
93
|
-
<a
|
|
94
|
-
href="{{ item.url }}"
|
|
95
|
-
class="ons-header-service-nav__link"
|
|
96
|
-
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
97
|
-
>{{ item.title }}</a>
|
|
98
|
-
{% else %}
|
|
99
|
-
{{ item.title }}
|
|
100
|
-
{% endif %}
|
|
101
|
-
</li>
|
|
102
|
-
{% endfor %}
|
|
103
|
-
</ul>
|
|
104
|
-
</nav>
|
|
105
|
-
</div>
|
|
106
|
-
{% if params.serviceLinks.itemsList | length > 1 or params.language %}
|
|
107
|
-
{% if params.variants == 'internal' or params.variants == 'neutral' %}
|
|
108
|
-
{% set buttonVariant = ["mobile", "text-link", "text-link-inverse"] %}
|
|
109
|
-
{% else %}
|
|
110
|
-
{% set buttonVariant = ["mobile", "text-link"] %}
|
|
111
|
-
{% endif %}
|
|
112
|
-
<div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
|
|
113
|
-
{{ onsButton({
|
|
114
|
-
"text": params.serviceLinks.toggleServicesButton.text | default("Account"),
|
|
115
|
-
"classes": "ons-u-d-no ons-js-toggle-services",
|
|
116
|
-
"type": "button",
|
|
117
|
-
"variants": buttonVariant,
|
|
118
|
-
"attributes": {
|
|
119
|
-
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
|
|
120
|
-
"aria-controls": params.serviceLinks.id,
|
|
121
|
-
"aria-expanded": "false"
|
|
122
|
-
}
|
|
123
|
-
}) }}
|
|
124
|
-
</div>
|
|
125
|
-
{% endif %}
|
|
126
|
-
{% endif %}
|
|
127
|
-
</div>
|
|
64
|
+
{% if params.mastheadLogoUrl %}
|
|
65
|
+
</a>
|
|
128
66
|
{% endif %}
|
|
129
67
|
</div>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<nav class="ons-header-service-nav ons-header-service-nav--mobile ons-u-d-no ons-js-services-mobile-nav" id="{{ params.serviceLinks.id }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
133
|
-
<ul class="ons-header-service-nav__list">
|
|
134
|
-
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
135
|
-
<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
|
|
136
|
-
{% if item.iconType %}
|
|
137
|
-
{{
|
|
138
|
-
onsIcon({
|
|
139
|
-
"iconType": item.iconType
|
|
140
|
-
})
|
|
141
|
-
}}
|
|
142
|
-
{% endif %}
|
|
143
|
-
{% if item.url %}
|
|
144
|
-
<a
|
|
145
|
-
href="{{ item.url }}"
|
|
146
|
-
class="ons-header-service-nav__link"
|
|
147
|
-
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
148
|
-
>{{ item.title }}</a>
|
|
149
|
-
{% else %}
|
|
150
|
-
{{ item.title }}
|
|
151
|
-
{% endif %}
|
|
152
|
-
</li>
|
|
153
|
-
{% endfor %}
|
|
68
|
+
{% if params.language or params.serviceLinks %}
|
|
69
|
+
<div class="ons-header__links ons-grid__col ons-col-auto">
|
|
154
70
|
{% if params.language %}
|
|
155
|
-
<div class="ons-u-d-no@xs">
|
|
71
|
+
<div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks else '' }}">
|
|
156
72
|
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
157
73
|
{{ onsLanguageSelector(params.language) }}
|
|
158
74
|
</div>
|
|
159
75
|
{% endif %}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
76
|
+
{% if params.serviceLinks %}
|
|
77
|
+
{% if params.serviceLinks.itemsList | length == 1 and params.language %}
|
|
78
|
+
{% set breakpoint = 'xs' %}
|
|
79
|
+
{% set controlVisibility = true %}
|
|
80
|
+
{% elif params.serviceLinks.itemsList | length > 1 %}
|
|
81
|
+
{% set breakpoint = 'm' %}
|
|
82
|
+
{% set controlVisibility = true %}
|
|
83
|
+
{% else %}
|
|
84
|
+
{% set controlVisibility = false %}
|
|
85
|
+
{% endif %}
|
|
86
|
+
<div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
|
|
87
|
+
<nav class="ons-header-service-nav ons-header-service-nav--main {{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
88
|
+
<ul class="ons-header-service-nav__list">
|
|
89
|
+
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
90
|
+
<li class="ons-header-service-nav__item">
|
|
91
|
+
{% if item.iconType %}
|
|
92
|
+
{{
|
|
93
|
+
onsIcon({
|
|
94
|
+
"iconType": item.iconType
|
|
95
|
+
})
|
|
96
|
+
}}
|
|
97
|
+
{% endif %}
|
|
98
|
+
{% if item.url %}
|
|
99
|
+
<a
|
|
100
|
+
href="{{ item.url }}"
|
|
101
|
+
class="ons-header-service-nav__link"
|
|
102
|
+
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
103
|
+
>{{ item.title }}</a>
|
|
104
|
+
{% else %}
|
|
105
|
+
{{ item.title }}
|
|
106
|
+
{% endif %}
|
|
107
|
+
</li>
|
|
108
|
+
{% endfor %}
|
|
109
|
+
</ul>
|
|
110
|
+
</nav>
|
|
111
|
+
</div>
|
|
112
|
+
{% if params.serviceLinks.itemsList | length > 1 or params.language %}
|
|
113
|
+
{% if params.variants == 'internal' or params.variants == 'neutral' %}
|
|
114
|
+
{% set buttonVariant = ["mobile", "text-link", "text-link-inverse"] %}
|
|
115
|
+
{% else %}
|
|
116
|
+
{% set buttonVariant = ["mobile", "text-link"] %}
|
|
117
|
+
{% endif %}
|
|
118
|
+
<div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
|
|
119
|
+
{{ onsButton({
|
|
120
|
+
"text": params.serviceLinks.toggleServicesButton.text | default("Account"),
|
|
121
|
+
"classes": "ons-u-d-no ons-js-toggle-services",
|
|
122
|
+
"type": "button",
|
|
123
|
+
"variants": buttonVariant,
|
|
124
|
+
"attributes": {
|
|
125
|
+
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
|
|
126
|
+
"aria-controls": params.serviceLinks.id,
|
|
127
|
+
"aria-expanded": "false"
|
|
128
|
+
}
|
|
129
|
+
}) }}
|
|
130
|
+
</div>
|
|
131
|
+
{% endif %}
|
|
132
|
+
{% endif %}
|
|
133
|
+
</div>
|
|
134
|
+
{% endif %}
|
|
135
|
+
</div>
|
|
163
136
|
</div>
|
|
164
|
-
|
|
137
|
+
{% if params.serviceLinks %}
|
|
138
|
+
<nav class="ons-header-service-nav ons-header-service-nav--mobile ons-u-d-no ons-js-services-mobile-nav" id="{{ params.serviceLinks.id }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
139
|
+
<ul class="ons-header-service-nav__list">
|
|
140
|
+
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
141
|
+
<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
|
|
142
|
+
{% if item.iconType %}
|
|
143
|
+
{{
|
|
144
|
+
onsIcon({
|
|
145
|
+
"iconType": item.iconType
|
|
146
|
+
})
|
|
147
|
+
}}
|
|
148
|
+
{% endif %}
|
|
149
|
+
{% if item.url %}
|
|
150
|
+
<a
|
|
151
|
+
href="{{ item.url }}"
|
|
152
|
+
class="ons-header-service-nav__link"
|
|
153
|
+
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
154
|
+
>{{ item.title }}</a>
|
|
155
|
+
{% else %}
|
|
156
|
+
{{ item.title }}
|
|
157
|
+
{% endif %}
|
|
158
|
+
</li>
|
|
159
|
+
{% endfor %}
|
|
160
|
+
{% if params.language %}
|
|
161
|
+
<div class="ons-u-d-no@xs">
|
|
162
|
+
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
163
|
+
{{ onsLanguageSelector(params.language) }}
|
|
164
|
+
</div>
|
|
165
|
+
{% endif %}
|
|
166
|
+
</ul>
|
|
167
|
+
</nav>
|
|
168
|
+
{% endif %}
|
|
169
|
+
</div>
|
|
165
170
|
<div class="ons-header__main">
|
|
166
171
|
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
167
172
|
<div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
|
|
168
173
|
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
|
|
169
|
-
{% if params.titleLogo
|
|
170
|
-
{% if params.
|
|
171
|
-
<a class="ons-header__title-logo-link" href="{{ params.
|
|
174
|
+
{% if params.titleLogo.large %}
|
|
175
|
+
{% if params.titleUrl %}
|
|
176
|
+
<a class="ons-header__title-logo-link" href="{{ params.titleUrl }}">
|
|
172
177
|
{% endif %}
|
|
173
|
-
<div class="ons-header__title-logo ons-header__title-logo--large {% if params.
|
|
174
|
-
{
|
|
175
|
-
{{
|
|
176
|
-
onsIcon({
|
|
177
|
-
"iconType": params.titleLogo,
|
|
178
|
-
"altText": params.titleLogoAlt
|
|
179
|
-
})
|
|
180
|
-
}}
|
|
178
|
+
<div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogo.classes %} {{ params.titleLogo.classes }} {% endif %}{% if params.titleLogo.small %}ons-u-d-no@xxs@s{% endif %}">
|
|
179
|
+
{{ params.titleLogo.large | safe }}
|
|
181
180
|
</div>
|
|
182
|
-
{% if params.
|
|
183
|
-
<div class="ons-header__title-logo ons-header__title-logo--
|
|
184
|
-
{
|
|
185
|
-
{{
|
|
186
|
-
onsIcon({
|
|
187
|
-
"iconType": params.titleLogoMobile,
|
|
188
|
-
"altText": params.titleLogoAlt
|
|
189
|
-
})
|
|
190
|
-
}}
|
|
181
|
+
{% if params.titleLogo.small %}
|
|
182
|
+
<div class="ons-header__title-logo ons-header__title-logo--small ons-u-d-no@s{% if params.titleLogo.classes %} {{ params.titleLogo.classes }}{% endif %}">
|
|
183
|
+
{{ params.titleLogo.small | safe}}
|
|
191
184
|
</div>
|
|
192
185
|
{% endif %}
|
|
193
|
-
{% if params.
|
|
186
|
+
{% if params.titleUrl %}
|
|
194
187
|
</a>
|
|
195
188
|
{% endif %}
|
|
196
189
|
{% else %}
|
|
197
|
-
{% if params.
|
|
198
|
-
<a class="ons-header__title-link" href="{{ params.
|
|
190
|
+
{% if params.titleUrl %}
|
|
191
|
+
<a class="ons-header__title-link" href="{{ params.titleUrl }}">
|
|
199
192
|
{% endif %}
|
|
200
193
|
<{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
|
|
201
|
-
{% if params.
|
|
194
|
+
{% if params.titleUrl %}
|
|
202
195
|
</a>
|
|
203
196
|
{% endif %}
|
|
204
197
|
{% endif %}
|
|
@@ -226,17 +219,9 @@
|
|
|
226
219
|
}) }}
|
|
227
220
|
</div>
|
|
228
221
|
{% endif %}
|
|
229
|
-
{% if params.navigation %}
|
|
222
|
+
{% if params.navigation or params.siteSearchAutosuggest %}
|
|
230
223
|
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
231
|
-
{% if params.
|
|
232
|
-
{% if params.language %}
|
|
233
|
-
<div class="ons-grid__col ons-col-auto ons-u-mt-xxs@xxs@l ons-u-mr-xs@xxs@s {% if params.navigation.siteSearchAutosuggest %}ons-header__lang-adjustment{% endif %}">
|
|
234
|
-
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
235
|
-
{{ onsLanguageSelector(params.language) }}
|
|
236
|
-
</div>
|
|
237
|
-
{% endif %}
|
|
238
|
-
{% endif %}
|
|
239
|
-
{% if params.navigation.siteSearchAutosuggest %}
|
|
224
|
+
{% if params.siteSearchAutosuggest %}
|
|
240
225
|
{% if params.variants == 'neutral' %}
|
|
241
226
|
{% set buttonVariant = ["small", "ghost-dark"] %}
|
|
242
227
|
{% else %}
|
|
@@ -163,7 +163,7 @@ describe('macro: header', () => {
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it('has the correct masthead logo link', () => {
|
|
166
|
-
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC,
|
|
166
|
+
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC, mastheadLogoUrl: '#0' }));
|
|
167
167
|
|
|
168
168
|
expect($('.ons-header__org-logo-link').attr('href')).toBe('#0');
|
|
169
169
|
});
|
|
@@ -177,13 +177,13 @@ describe('macro: header', () => {
|
|
|
177
177
|
expect(iconsSpy.occurrences[0].iconType).toBe('ons-logo-en');
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
it('has the
|
|
180
|
+
it('has the default masthead mobile logo icon', () => {
|
|
181
181
|
const faker = templateFaker();
|
|
182
182
|
const iconsSpy = faker.spy('icons');
|
|
183
183
|
|
|
184
|
-
faker.renderComponent('header',
|
|
184
|
+
faker.renderComponent('header', EXAMPLE_HEADER_BASIC);
|
|
185
185
|
|
|
186
|
-
expect(iconsSpy.occurrences[
|
|
186
|
+
expect(iconsSpy.occurrences[1].iconType).toBe('ons-logo-stacked-en');
|
|
187
187
|
});
|
|
188
188
|
|
|
189
189
|
it('has the default masthead logo icon alt text', () => {
|
|
@@ -195,49 +195,44 @@ describe('macro: header', () => {
|
|
|
195
195
|
expect(iconsSpy.occurrences[0].altText).toBe('Office for National Statistics logo');
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
-
it('has the
|
|
199
|
-
const faker = templateFaker();
|
|
200
|
-
const iconsSpy = faker.spy('icons');
|
|
201
|
-
|
|
202
|
-
faker.renderComponent('header', { ...EXAMPLE_HEADER_BASIC, orgLogoAlt: 'Custom alt text' });
|
|
203
|
-
|
|
204
|
-
expect(iconsSpy.occurrences[0].altText).toBe('Custom alt text');
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('has the default masthead mobile logo icon', () => {
|
|
198
|
+
it('has the default masthead mobile logo icon alt text', () => {
|
|
208
199
|
const faker = templateFaker();
|
|
209
200
|
const iconsSpy = faker.spy('icons');
|
|
210
201
|
|
|
211
202
|
faker.renderComponent('header', EXAMPLE_HEADER_BASIC);
|
|
212
203
|
|
|
213
|
-
expect(iconsSpy.occurrences[1].
|
|
204
|
+
expect(iconsSpy.occurrences[1].altText).toBe('Office for National Statistics logo');
|
|
214
205
|
});
|
|
215
206
|
|
|
216
|
-
it('has the provided masthead
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
faker.renderComponent('header', { ...EXAMPLE_HEADER_BASIC, orgMobileLogo: 'another-mobile-logo' });
|
|
207
|
+
it('has the provided large masthead logo', () => {
|
|
208
|
+
const $ = cheerio.load(
|
|
209
|
+
renderComponent('header', { ...EXAMPLE_HEADER_BASIC, mastheadLogo: { large: '<img src="another-logo.svg">' } }),
|
|
210
|
+
);
|
|
221
211
|
|
|
222
|
-
expect(
|
|
212
|
+
expect($('.ons-header__org-logo--large img').attr('src')).toBe('another-logo.svg');
|
|
223
213
|
});
|
|
224
214
|
|
|
225
|
-
it('has the
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
215
|
+
it('has the provided masthead logo custom classes', () => {
|
|
216
|
+
const $ = cheerio.load(
|
|
217
|
+
renderComponent('header', {
|
|
218
|
+
...EXAMPLE_HEADER_BASIC,
|
|
219
|
+
mastheadLogo: { large: '<img src="another-logo.svg">', classes: 'custom-class another-custom-class' },
|
|
220
|
+
}),
|
|
221
|
+
);
|
|
230
222
|
|
|
231
|
-
expect(
|
|
223
|
+
expect($('.ons-header__grid-top').hasClass('custom-class')).toBe(true);
|
|
224
|
+
expect($('.ons-header__grid-top').hasClass('another-custom-class')).toBe(true);
|
|
232
225
|
});
|
|
233
226
|
|
|
234
|
-
it('has the provided masthead
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
227
|
+
it('has the provided small masthead logo', () => {
|
|
228
|
+
const $ = cheerio.load(
|
|
229
|
+
renderComponent('header', {
|
|
230
|
+
...EXAMPLE_HEADER_BASIC,
|
|
231
|
+
mastheadLogo: { large: 'another-logo.svg', small: '<img src="another-logo-small.svg">' },
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
239
234
|
|
|
240
|
-
expect(
|
|
235
|
+
expect($('.ons-header__org-logo--small img').attr('src')).toBe('another-logo-small.svg');
|
|
241
236
|
});
|
|
242
237
|
|
|
243
238
|
it('displays the `title` text', () => {
|
|
@@ -259,59 +254,38 @@ describe('macro: header', () => {
|
|
|
259
254
|
});
|
|
260
255
|
|
|
261
256
|
it('has the correct `title` link', () => {
|
|
262
|
-
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC,
|
|
257
|
+
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC, titleUrl: '#0' }));
|
|
263
258
|
|
|
264
259
|
expect($('.ons-header__title-link').attr('href')).toBe('#0');
|
|
265
260
|
});
|
|
266
261
|
|
|
267
|
-
it('has the provided title logo
|
|
268
|
-
const
|
|
269
|
-
const iconsSpy = faker.spy('icons');
|
|
270
|
-
|
|
271
|
-
faker.renderComponent('header', { ...EXAMPLE_HEADER_BASIC, titleLogo: 'custom-title-logo', titleLogoAlt: 'custom logo alt' });
|
|
262
|
+
it('has the provided large title logo', () => {
|
|
263
|
+
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC, titleLogo: { large: '<img src="another-logo.svg">' } }));
|
|
272
264
|
|
|
273
|
-
expect(
|
|
265
|
+
expect($('.ons-header__title-logo--large img').attr('src')).toBe('another-logo.svg');
|
|
274
266
|
});
|
|
275
267
|
|
|
276
|
-
it('has the provided title logo classes', () => {
|
|
268
|
+
it('has the provided title logo custom classes', () => {
|
|
277
269
|
const $ = cheerio.load(
|
|
278
270
|
renderComponent('header', {
|
|
279
271
|
...EXAMPLE_HEADER_BASIC,
|
|
280
|
-
titleLogo: 'custom-
|
|
281
|
-
titleLogoClasses: 'custom-class',
|
|
282
|
-
titleLogoAlt: 'custom logo alt',
|
|
272
|
+
titleLogo: { large: 'another-logo.svg', classes: 'custom-class another-custom-class' },
|
|
283
273
|
}),
|
|
284
274
|
);
|
|
285
275
|
|
|
286
276
|
expect($('.ons-header__title-logo--large').hasClass('custom-class')).toBe(true);
|
|
277
|
+
expect($('.ons-header__title-logo--large').hasClass('another-custom-class')).toBe(true);
|
|
287
278
|
});
|
|
288
279
|
|
|
289
|
-
it('has the provided title logo
|
|
290
|
-
const faker = templateFaker();
|
|
291
|
-
const iconsSpy = faker.spy('icons');
|
|
292
|
-
|
|
293
|
-
faker.renderComponent('header', {
|
|
294
|
-
...EXAMPLE_HEADER_BASIC,
|
|
295
|
-
titleLogo: 'custom-title-logo',
|
|
296
|
-
titleLogoMobile: 'custom-title-mobile-logo',
|
|
297
|
-
titleLogoAlt: 'custom logo alt',
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
expect(iconsSpy.occurrences[3].iconType).toBe('custom-title-mobile-logo');
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
it('has the provided title logo mobile classes', () => {
|
|
280
|
+
it('has the provided small title logo', () => {
|
|
304
281
|
const $ = cheerio.load(
|
|
305
282
|
renderComponent('header', {
|
|
306
283
|
...EXAMPLE_HEADER_BASIC,
|
|
307
|
-
titleLogo: '
|
|
308
|
-
titleLogoMobile: 'custom-title-mobile-logo',
|
|
309
|
-
titleLogoMobileClasses: 'custom-mobile-class',
|
|
310
|
-
titleLogoAlt: 'custom logo alt',
|
|
284
|
+
titleLogo: { large: '<img src="another-logo.svg">', small: '<img src="another-logo-small.svg">' },
|
|
311
285
|
}),
|
|
312
286
|
);
|
|
313
287
|
|
|
314
|
-
expect($('.ons-header__title-logo--
|
|
288
|
+
expect($('.ons-header__title-logo--small img').attr('src')).toBe('another-logo-small.svg');
|
|
315
289
|
});
|
|
316
290
|
|
|
317
291
|
it('displays the `description` text', () => {
|
|
@@ -653,8 +627,8 @@ describe('macro: header', () => {
|
|
|
653
627
|
text: 'Menu',
|
|
654
628
|
ariaLabel: 'Toggle main menu',
|
|
655
629
|
},
|
|
656
|
-
siteSearchAutosuggest: {},
|
|
657
630
|
},
|
|
631
|
+
siteSearchAutosuggest: {},
|
|
658
632
|
});
|
|
659
633
|
|
|
660
634
|
expect(buttonSpy.occurrences[0]).toEqual({
|
|
@@ -671,12 +645,4 @@ describe('macro: header', () => {
|
|
|
671
645
|
});
|
|
672
646
|
});
|
|
673
647
|
});
|
|
674
|
-
|
|
675
|
-
describe('mode: without masthead', () => {
|
|
676
|
-
it('does not render the masthead', () => {
|
|
677
|
-
const $ = cheerio.load(renderComponent('header', { ...EXAMPLE_HEADER_BASIC, ...EXAMPLE_HEADER_LANGUAGE_CONFIG, noMasthead: true }));
|
|
678
|
-
|
|
679
|
-
expect($('.ons-header__top').length).toBe(0);
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
648
|
});
|