@ons/design-system 70.0.17 → 72.0.1
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/_macro.njk +4 -4
- package/components/access-code/_macro.spec.js +8 -8
- package/components/access-code/example-access-code-error.njk +2 -2
- package/components/access-code/example-access-code.njk +2 -2
- package/components/accordion/_macro.njk +1 -1
- package/components/accordion/_macro.spec.js +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-input/_macro.spec.js +16 -15
- package/components/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +25 -25
- package/components/address-input/autosuggest.address.spec.js +6 -5
- package/components/address-input/example-address-input-editable.njk +5 -4
- package/components/address-input/example-address-input.njk +4 -5
- package/components/autosuggest/_autosuggest.scss +8 -8
- package/components/autosuggest/_macro.njk +5 -5
- package/components/autosuggest/autosuggest.spec.js +1 -1
- package/components/back-to-top/_back-to-top.scss +2 -2
- package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
- package/components/breadcrumbs/_breadcrumbs.scss +1 -1
- package/components/button/_button.scss +24 -16
- package/components/button/_macro.njk +3 -3
- package/components/button/example-button-custom.njk +1 -1
- package/components/card/_card.scss +0 -6
- package/components/card/_macro.njk +9 -9
- package/components/card/_macro.spec.js +57 -24
- package/components/card/example-card-set-with-images.njk +30 -18
- package/components/card/example-card-set-with-lists.njk +57 -45
- package/components/card/example-card-set.njk +27 -15
- package/components/card/example-card.njk +9 -5
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +4 -4
- package/components/checkboxes/_checkboxes.scss +1 -1
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
- package/components/cookies-banner/_cookies-banner.scss +5 -5
- package/components/cookies-banner/_macro.njk +15 -13
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +5 -6
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_document-list.scss +0 -2
- package/components/document-list/_macro.njk +18 -18
- package/components/document-list/_macro.spec.js +16 -14
- package/components/document-list/example-document-list-article-featured.njk +5 -3
- package/components/document-list/example-document-list-articles.njk +15 -9
- package/components/document-list/example-document-list-downloads.njk +15 -9
- package/components/document-list/example-document-list-search-result-featured.njk +5 -3
- package/components/document-list/example-document-list-search-results.njk +20 -12
- package/components/download-resources/_download-resources.scss +1 -2
- package/components/download-resources/download-resources.spec.js +12 -6
- package/components/external-link/_macro.njk +1 -1
- package/components/external-link/_macro.spec.js +1 -1
- package/components/external-link/example-external-link.njk +1 -1
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +3 -3
- package/components/feedback/example-feedback-call-to-action.njk +1 -1
- package/components/field/_field-group.scss +0 -2
- package/components/field/_field.scss +1 -2
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/fieldset/_macro.njk +1 -1
- package/components/fieldset/_macro.spec.js +1 -1
- package/components/footer/_footer.scss +12 -7
- package/components/footer/_macro.njk +54 -34
- package/components/footer/_macro.spec.js +90 -28
- package/components/footer/example-footer-cymraeg.njk +1 -1
- package/components/footer/example-footer-transactional.njk +1 -1
- package/components/footer/example-footer-warning.njk +1 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
- package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
- package/components/footer/example-footer-with-copyright.njk +1 -1
- package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
- package/components/footer/example-footer-with-multiple-logos.njk +172 -0
- package/components/footer/example-footer.njk +1 -1
- package/components/header/_header.scss +7 -14
- package/components/header/_macro.njk +19 -19
- package/components/header/_macro.spec.js +17 -17
- package/components/header/example-header-external-for-surveys.njk +2 -2
- package/components/header/example-header-external-welsh.njk +2 -2
- package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
- package/components/header/example-header-external-with-sub-navigation.njk +1 -1
- package/components/header/example-header-multiple-logos.njk +4 -4
- package/components/hero/_hero.scss +6 -8
- package/components/hero/_macro.njk +1 -1
- package/components/icon/_icon.scss +4 -4
- package/components/icon/_macro.njk +4 -4
- package/components/icon/_macro.spec.js +2 -2
- package/components/image/_image.scss +1 -1
- package/components/image/_macro.njk +1 -1
- package/components/image/_macro.spec.js +10 -10
- package/components/image/example-image-for-regular-screens.njk +1 -1
- package/components/input/_input-type.scss +0 -2
- package/components/input/_input.scss +10 -10
- package/components/input/_macro.njk +4 -2
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_label.scss +1 -3
- package/components/language-selector/_macro.njk +3 -3
- package/components/language-selector/_macro.spec.js +7 -7
- package/components/list/_list.scss +1 -5
- package/components/list/_macro.njk +9 -10
- package/components/list/_macro.spec.js +50 -9
- package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
- package/components/message/_macro.njk +3 -3
- package/components/message/_macro.spec.js +3 -3
- package/components/message-list/_macro.njk +2 -2
- package/components/message-list/_macro.spec.js +8 -4
- package/components/message-list/_message-list.scss +2 -2
- package/components/navigation/_macro.njk +9 -9
- package/components/navigation/_macro.spec.js +2 -2
- package/components/navigation/_navigation.scss +2 -6
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +4 -4
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/_pagination.scss +1 -7
- package/components/panel/_macro.njk +5 -4
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/_panel.scss +12 -8
- package/components/password/_macro.njk +1 -1
- package/components/password/_macro.spec.js +2 -2
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +3 -4
- package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
- package/components/phase-banner/example-phase-banner-beta.njk +1 -1
- package/components/question/_macro.njk +8 -8
- package/components/question/_macro.spec.js +3 -3
- package/components/question/_question.scss +3 -3
- package/components/radios/_macro.njk +1 -1
- package/components/radios/_macro.spec.js +1 -1
- package/components/radios/_radios.scss +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
- package/components/radios/example-radios-with-clear-button.njk +1 -1
- package/components/related-content/_macro.spec.js +2 -2
- package/components/related-content/_related-content.scss +1 -1
- package/components/related-content/example-related-content-general.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +1 -1
- package/components/reply/_macro.njk +3 -1
- package/components/reply/_macro.spec.js +1 -1
- package/components/reply/reply.spec.js +1 -1
- package/components/section-navigation/_macro.njk +10 -10
- package/components/section-navigation/_macro.spec.js +15 -15
- package/components/section-navigation/_section-navigation.scss +4 -10
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
- package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
- package/components/section-navigation/example-section-navigation.njk +3 -3
- package/components/select/example-select-with-inline-label.njk +1 -1
- package/components/share-page/_macro.njk +7 -7
- package/components/share-page/_macro.spec.js +2 -2
- package/components/share-page/example-share-page.njk +1 -1
- package/components/status/_status.scss +1 -1
- package/components/summary/_macro.njk +33 -33
- package/components/summary/_macro.spec.js +34 -34
- package/components/summary/_summary.scss +2 -4
- package/components/summary/example-summary-card-grouped.njk +34 -34
- package/components/summary/example-summary-grouped-total.njk +7 -7
- package/components/summary/example-summary-grouped-with-errors.njk +9 -9
- package/components/summary/example-summary-grouped.njk +34 -34
- package/components/summary/example-summary-household.njk +7 -7
- package/components/summary/example-summary-hub-minimal.njk +8 -8
- package/components/summary/example-summary-hub.njk +16 -16
- package/components/summary/example-summary-multiple.njk +7 -7
- package/components/summary/example-summary-no-action.njk +5 -5
- package/components/summary/example-summary.njk +9 -9
- package/components/table/_table.scss +2 -3
- package/components/table-of-contents/_macro.njk +3 -3
- package/components/table-of-contents/_macro.spec.js +3 -3
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/tabs/_macro.njk +3 -3
- package/components/tabs/_macro.spec.js +3 -3
- package/components/tabs/_tabs.scss +3 -4
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/text-indent/_text-indent.scss +1 -1
- package/components/timeline/_macro.njk +4 -4
- package/components/timeline/_macro.spec.js +3 -3
- package/components/timeline/_timeline.scss +4 -3
- package/components/timeline/example-timeline.njk +1 -1
- package/components/upload/_upload.scss +2 -2
- package/components/video/_macro.njk +4 -4
- package/components/video/_macro.spec.js +2 -2
- package/components/video/_video.scss +1 -1
- package/components/video/example-video.njk +2 -2
- package/components/video/video.spec.js +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +1 -1
- package/layout/_template.njk +31 -31
- package/package.json +4 -5
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +2 -0
- package/scss/base/_typography.scss +0 -2
- package/scss/main.scss +0 -1
- package/scss/objects/_container.scss +1 -1
- package/scss/objects/_page.scss +2 -3
- package/scss/overrides/rtl.scss +1 -1
- package/scss/utilities/_grid.scss +103 -96
- package/scss/utilities/_margin.scss +11 -5
- package/scss/utilities/_padding.scss +12 -5
- package/scss/utilities/_typography.scss +2 -1
- package/scss/vars/_forms.scss +8 -10
- package/scss/vars/_grid.scss +4 -4
- package/scss/vars/_typography.scss +26 -19
- package/components/call-to-action/_call-to-action.scss +0 -8
- package/components/call-to-action/_macro.njk +0 -24
- package/components/call-to-action/_macro.spec.js +0 -48
- package/components/call-to-action/example-call-to-action-default.njk +0 -15
- package/components/metadata/_macro.njk +0 -14
|
@@ -147,8 +147,10 @@ const EXAMPLE_PAGE = `
|
|
|
147
147
|
'data-filter': 'general-public booklet',
|
|
148
148
|
'data-sort-index': '1',
|
|
149
149
|
},
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
title: {
|
|
151
|
+
url: '/example-booklet-1',
|
|
152
|
+
text: 'Example booklet 1',
|
|
153
|
+
},
|
|
152
154
|
description: 'The first example booklet.',
|
|
153
155
|
},
|
|
154
156
|
{
|
|
@@ -157,8 +159,10 @@ const EXAMPLE_PAGE = `
|
|
|
157
159
|
'data-filter': 'general-public booklet logo',
|
|
158
160
|
'data-sort-index': '2',
|
|
159
161
|
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
title: {
|
|
163
|
+
url: '/example-booklet-2',
|
|
164
|
+
text: 'Example booklet 2 with logo',
|
|
165
|
+
},
|
|
162
166
|
description: 'The second example booklet with a logo.',
|
|
163
167
|
},
|
|
164
168
|
{
|
|
@@ -167,8 +171,10 @@ const EXAMPLE_PAGE = `
|
|
|
167
171
|
'data-filter': 'logo',
|
|
168
172
|
'data-sort-index': '3',
|
|
169
173
|
},
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
title: {
|
|
175
|
+
url: '/example-logo',
|
|
176
|
+
text: 'Example logo',
|
|
177
|
+
},
|
|
172
178
|
description: 'An example logo.',
|
|
173
179
|
},
|
|
174
180
|
],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro onsExternalLink(params) %}
|
|
4
4
|
<a href="{{ params.url }}" class="ons-external-link{{ ' ' + params.classes if params.classes else '' }}" target="_blank" rel="noopener">
|
|
5
|
-
<span class="ons-external-link__text"> {{- params.
|
|
5
|
+
<span class="ons-external-link__text"> {{- params.text | safe -}} </span
|
|
6
6
|
><span class="ons-external-link__icon"> {{- onsIcon({"iconType": 'external-link'}) -}} </span
|
|
7
7
|
><span class="ons-external-link__new-window-description ons-u-vh"
|
|
8
8
|
>({{- params.newWindowDescription | default("opens in a new tab") -}})</span
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
{{ params.heading }}
|
|
8
8
|
{{ closingHeadingTag | safe }}
|
|
9
9
|
<p class="ons-feedback__content">{{- params.content | safe -}}</p>
|
|
10
|
-
<a href="{{ params.
|
|
10
|
+
<a href="{{ params.linkUrl }}" class="ons-feedback__link">{{- params.linkText -}}</a>
|
|
11
11
|
</div>
|
|
12
12
|
{% endmacro %}
|
|
@@ -8,7 +8,7 @@ import { renderComponent } from '../../tests/helpers/rendering';
|
|
|
8
8
|
const EXAMPLE_FEEDBACK_MINIMAL = {
|
|
9
9
|
heading: 'Feedback heading',
|
|
10
10
|
content: 'Feedback content...',
|
|
11
|
-
|
|
11
|
+
linkUrl: 'http://example.com',
|
|
12
12
|
linkText: 'Feedback link text',
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ const EXAMPLE_FEEDBACK_FULL = {
|
|
|
19
19
|
headingLevel: 5,
|
|
20
20
|
headingClasses: 'extra-heading-class another-extra-heading-class',
|
|
21
21
|
content: 'Feedback content...',
|
|
22
|
-
|
|
22
|
+
linkUrl: 'http://example.com',
|
|
23
23
|
linkText: 'Feedback link text',
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -92,7 +92,7 @@ describe('macro: feedback', () => {
|
|
|
92
92
|
expect($('p').text().trim()).toBe('Feedback content...');
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it('has a link with the provided `
|
|
95
|
+
it('has a link with the provided `linkUrl`', () => {
|
|
96
96
|
const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
|
|
97
97
|
|
|
98
98
|
expect($('.ons-feedback__link').attr('href')).toBe('http://example.com');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
font-weight: $font-weight-bold;
|
|
4
4
|
margin: 0;
|
|
5
5
|
&:not(&--with-description) {
|
|
6
|
-
margin-bottom: 0.
|
|
6
|
+
margin-bottom: 0.5rem;
|
|
7
7
|
}
|
|
8
8
|
&-title {
|
|
9
9
|
display: block;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
&__description:not(&__description--title) {
|
|
20
20
|
@extend .ons-label__description;
|
|
21
21
|
|
|
22
|
-
margin-bottom: 0.
|
|
22
|
+
margin-bottom: 0.5rem;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&__description--title {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
{%- if params.description -%}
|
|
30
30
|
<div
|
|
31
31
|
id="{{ descriptionId }}"
|
|
32
|
-
class="ons-fieldset__description{{ ' ons-fieldset__description--title ons-u-mb-
|
|
32
|
+
class="ons-fieldset__description{{ ' ons-fieldset__description--title ons-u-mb-l' if params.legendIsQuestionTitle }}"
|
|
33
33
|
>
|
|
34
34
|
{{- params.description | safe -}}
|
|
35
35
|
</div>
|
|
@@ -183,7 +183,7 @@ describe('macro: fieldset', () => {
|
|
|
183
183
|
const $ = cheerio.load(renderComponent('fieldset', { ...EXAMPLE_FIELDSET_BASIC, legendIsQuestionTitle: true }));
|
|
184
184
|
|
|
185
185
|
expect($('.ons-fieldset__description').hasClass('ons-fieldset__description--title')).toBe(true);
|
|
186
|
-
expect($('.ons-fieldset__description').hasClass('ons-u-mb-
|
|
186
|
+
expect($('.ons-fieldset__description').hasClass('ons-u-mb-l')).toBe(true);
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
});
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
background-clip: border-box;
|
|
14
14
|
background-color: var(--ons-color-header);
|
|
15
15
|
padding: 1rem;
|
|
16
|
+
a {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
&__warning {
|
|
@@ -25,16 +28,18 @@
|
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
&__ogl-img {
|
|
28
|
-
margin: 0 0.5rem 0.
|
|
31
|
+
margin: 0 0.5rem 0.25rem 0;
|
|
29
32
|
max-width: 100%;
|
|
30
33
|
vertical-align: middle;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
&
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
&__logo-container {
|
|
37
|
+
gap: 1rem;
|
|
38
|
+
|
|
39
|
+
svg,
|
|
40
|
+
img {
|
|
41
|
+
max-height: 30px;
|
|
42
|
+
width: auto;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
|
|
55
60
|
&--rows {
|
|
56
61
|
li {
|
|
57
|
-
|
|
62
|
+
@extend .ons-u-mb-2xs;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
{% else %}
|
|
8
8
|
{% set lang = 'en' %}
|
|
9
9
|
{% endif %}
|
|
10
|
-
|
|
10
|
+
{% set extraLogo = params.footerLogo.logos.logo2 %}
|
|
11
11
|
{% set onsLogo %}
|
|
12
12
|
{% if params.lang == 'cy' %}
|
|
13
13
|
{{-
|
|
14
14
|
onsIcon({
|
|
15
|
-
"iconType": 'ons-logo-cy',
|
|
15
|
+
"iconType": 'ons-logo-stacked-cy' if extraLogo else 'ons-logo-cy',
|
|
16
16
|
"altText": 'Swyddfa Ystadegau Gwladol',
|
|
17
17
|
"altTextId": 'ons-logo-cy-footer-alt'
|
|
18
18
|
})
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{% else %}
|
|
21
21
|
{{-
|
|
22
22
|
onsIcon({
|
|
23
|
-
"iconType": 'ons-logo-en',
|
|
23
|
+
"iconType": 'ons-logo-stacked-en' if extraLogo else 'ons-logo-en' ,
|
|
24
24
|
"altText": 'Office for National Statistics',
|
|
25
25
|
"altTextId": 'ons-logo-en-footer-alt'
|
|
26
26
|
})
|
|
@@ -69,18 +69,20 @@
|
|
|
69
69
|
data-analytics="footer"
|
|
70
70
|
{% if params.attributes %}{% for attribute, value in (params.attributes) %}{{ ' ' }}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
71
71
|
>
|
|
72
|
-
<div
|
|
72
|
+
<div
|
|
73
|
+
class="ons-container{{ ' ons-container--full-width' if params.fullWidth else "" }}{{ ' ons-container--wide' if params.wide else "" }}"
|
|
74
|
+
>
|
|
73
75
|
<div class="ons-grid">
|
|
74
76
|
{% if params.newTabWarning %}
|
|
75
77
|
<div class="ons-grid__col">
|
|
76
|
-
<p class="ons-u-fs-s ons-u-mb-
|
|
78
|
+
<p class="ons-u-fs-s ons-u-mb-l ons-footer__new-tab-warning">{{ params.newTabWarning | safe }}</p>
|
|
77
79
|
</div>
|
|
78
80
|
{% endif %}
|
|
79
81
|
|
|
80
82
|
{% if params.cols %}
|
|
81
83
|
{% for col in params.cols %}
|
|
82
84
|
<!-- Full footer columns -->
|
|
83
|
-
<div class="ons-grid__col ons-col-4@m{{ ' ons-u-mt-
|
|
85
|
+
<div class="ons-grid__col ons-col-4@m{{ ' ons-u-mt-l@2xs@m' if loop.index > 1 }}">
|
|
84
86
|
{% if col.title %}
|
|
85
87
|
<h2 class="ons-footer__heading ons-u-fs-r--b">{{ col.title }}</h2>
|
|
86
88
|
{% endif %}
|
|
@@ -109,13 +111,13 @@
|
|
|
109
111
|
{% endif %}
|
|
110
112
|
|
|
111
113
|
{% if (params.cols) or (params.rows) %}
|
|
112
|
-
<div class="ons-grid__col ons-u-mb-
|
|
114
|
+
<div class="ons-grid__col ons-u-mb-l">
|
|
113
115
|
<hr class="ons-footer__hr" />
|
|
114
116
|
</div>
|
|
115
117
|
{% endif %}
|
|
116
118
|
</div>
|
|
117
119
|
|
|
118
|
-
<div class="ons-grid ons-grid
|
|
120
|
+
<div class="ons-grid{{ ' ons-grid-flex' if params.crest else "" }} ons-grid-flex--vertical-top ons-grid-flex--between">
|
|
119
121
|
<div class="ons-grid__col">
|
|
120
122
|
{% if params.legal %}
|
|
121
123
|
<!-- Legal -->
|
|
@@ -130,50 +132,71 @@
|
|
|
130
132
|
{% endfor %}
|
|
131
133
|
{% endif %}
|
|
132
134
|
|
|
133
|
-
{% if params.
|
|
135
|
+
{% if params.oglLink %}
|
|
134
136
|
<!-- OGL -->
|
|
135
|
-
<div class="ons-footer__license ons-u-mb-
|
|
137
|
+
<div class="ons-footer__license ons-u-mb-l">
|
|
136
138
|
{{-
|
|
137
139
|
onsIcon({
|
|
138
140
|
"iconType": 'ogl'
|
|
139
141
|
})
|
|
140
142
|
-}}
|
|
141
|
-
{% if params.
|
|
142
|
-
{{ params.
|
|
143
|
-
{% elif params.
|
|
143
|
+
{% if params.oglLink.html %}
|
|
144
|
+
{{ params.oglLink.html | safe }}
|
|
145
|
+
{% elif params.oglLink %}
|
|
144
146
|
{% from "components/external-link/_macro.njk" import onsExternalLink %}
|
|
145
147
|
{% if params.lang == 'cy' %}
|
|
146
|
-
{{ params.
|
|
148
|
+
{{ params.oglLink.pre | default('Mae’r holl gynnwys ar gael o dan y') }}
|
|
147
149
|
{{
|
|
148
150
|
onsExternalLink({
|
|
149
|
-
"url": params.
|
|
150
|
-
"
|
|
151
|
+
"url": params.oglLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
|
|
152
|
+
"text": params.oglLink.text | default('Drwydded Llywodraeth Leol v3.0')
|
|
151
153
|
})
|
|
152
|
-
}}{{ params.
|
|
154
|
+
}}{{ params.oglLink.post | default(', oni bai y nodir fel arall') }}
|
|
153
155
|
{% else %}
|
|
154
|
-
{{ params.
|
|
156
|
+
{{ params.oglLink.pre | default('All content is available under the') }}
|
|
155
157
|
{{
|
|
156
158
|
onsExternalLink({
|
|
157
|
-
"url": params.
|
|
158
|
-
"
|
|
159
|
+
"url": params.oglLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
|
|
160
|
+
"text": params.oglLink.text | default('Open Government Licence v3.0')
|
|
159
161
|
})
|
|
160
|
-
}}{{ params.
|
|
162
|
+
}}{{ params.oglLink.post | default(', except where otherwise stated') }}
|
|
161
163
|
{% endif %}
|
|
162
164
|
{% endif %}
|
|
163
165
|
</div>
|
|
164
166
|
{% endif %}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
|
|
168
|
+
{% if not params.footerLogo.logos.logo1 %}
|
|
169
|
+
{%
|
|
170
|
+
set logo1 = {
|
|
171
|
+
'logoUrl': 'https://cy.ons.gov.uk/' if lang == 'cy' else 'https://www.ons.gov.uk/',
|
|
172
|
+
'logoImage': onsLogo | safe
|
|
173
|
+
}
|
|
174
|
+
%}
|
|
175
|
+
{% set logos = [logo1, params.footerLogo.logos.logo2] %}
|
|
176
|
+
{% else %}
|
|
177
|
+
{% set logos = [params.footerLogo.logos.logo1, params.footerLogo.logos.logo2] %}
|
|
172
178
|
{% endif %}
|
|
179
|
+
|
|
180
|
+
<div
|
|
181
|
+
class="ons-footer__logo-container ons-u-mb-l ons-grid-flex ons-grid-flex--vertical-top{{ ' ons-grid-flex--between' if params.footerLogo.display == 'split' else "" }}"
|
|
182
|
+
>
|
|
183
|
+
{% for logo in logos %}
|
|
184
|
+
{%- if logo.logoUrl -%}
|
|
185
|
+
<a
|
|
186
|
+
class="ons-footer__logo-link{{ ' ons-u-mr-s' if extraLogo and loop.index == 1 else "" }}"
|
|
187
|
+
href="{{ logo.logoUrl }}"
|
|
188
|
+
>{{ logo.logoImage | safe }}</a
|
|
189
|
+
>
|
|
190
|
+
{%- else -%}
|
|
191
|
+
|
|
192
|
+
{{ logo.logoImage | safe }}
|
|
193
|
+
{% endif %}
|
|
194
|
+
{% endfor %}
|
|
195
|
+
</div>
|
|
173
196
|
</div>
|
|
174
197
|
{% if params.crest %}
|
|
175
198
|
<!-- Crest -->
|
|
176
|
-
<div class="ons-grid__col ons-footer__crest ons-u-mb-
|
|
199
|
+
<div class="ons-grid__col ons-footer__crest ons-u-mb-l@2xs@l">
|
|
177
200
|
{{-
|
|
178
201
|
onsIcon({
|
|
179
202
|
"iconType": 'crest'
|
|
@@ -182,15 +205,12 @@
|
|
|
182
205
|
</div>
|
|
183
206
|
{% endif %}
|
|
184
207
|
</div>
|
|
185
|
-
{% if params.poweredBy %}
|
|
186
|
-
{{ params.poweredBy | safe }}
|
|
187
|
-
{% endif %}
|
|
188
208
|
{% if params.copyrightDeclaration %}
|
|
189
209
|
<!-- Copyright -->
|
|
190
210
|
{% set copyrightDeclaration = '© ' + params.copyrightDeclaration.copyright + '<br /> ' + params.copyrightDeclaration.text %}
|
|
191
|
-
<div class="ons-grid ons-grid
|
|
211
|
+
<div class="ons-grid ons-grid-flex ons-grid-flex--between">
|
|
192
212
|
<div class="ons-grid__col">
|
|
193
|
-
<p class="ons-u-fs-s ons-u-mb-
|
|
213
|
+
<p class="ons-u-fs-s ons-u-mb-l ons-footer__copyright">{{- copyrightDeclaration | safe -}}</p>
|
|
194
214
|
</div>
|
|
195
215
|
</div>
|
|
196
216
|
{% endif %}
|
|
@@ -8,7 +8,7 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
|
8
8
|
|
|
9
9
|
const EXAMPLE_OGL_LINK_PARAM = {
|
|
10
10
|
pre: 'All content is available under the',
|
|
11
|
-
|
|
11
|
+
text: 'Open Government Licence v3.0',
|
|
12
12
|
url: 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
|
|
13
13
|
post: ', except where otherwise stated',
|
|
14
14
|
};
|
|
@@ -125,7 +125,7 @@ describe('macro: footer', () => {
|
|
|
125
125
|
|
|
126
126
|
describe('OGL link', () => {
|
|
127
127
|
const params = {
|
|
128
|
-
|
|
128
|
+
oglLink: EXAMPLE_OGL_LINK_PARAM,
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
it('passes jest-axe checks', async () => {
|
|
@@ -144,12 +144,12 @@ describe('macro: footer', () => {
|
|
|
144
144
|
expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining({ iconType: 'ogl' }));
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
-
it('renders raw HTML when `
|
|
147
|
+
it('renders raw HTML when `html` is provided', () => {
|
|
148
148
|
const $ = cheerio.load(
|
|
149
149
|
renderComponent('footer', {
|
|
150
|
-
|
|
151
|
-
...params.
|
|
152
|
-
|
|
150
|
+
oglLink: {
|
|
151
|
+
...params.oglLink,
|
|
152
|
+
html: '<strong>Bold text.</strong>',
|
|
153
153
|
},
|
|
154
154
|
}),
|
|
155
155
|
);
|
|
@@ -167,7 +167,7 @@ describe('macro: footer', () => {
|
|
|
167
167
|
expect(externalLinkSpy.occurrences).toContainEqual(
|
|
168
168
|
expect.objectContaining({
|
|
169
169
|
url: 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
|
|
170
|
-
|
|
170
|
+
text: 'Open Government Licence v3.0',
|
|
171
171
|
}),
|
|
172
172
|
);
|
|
173
173
|
});
|
|
@@ -179,11 +179,11 @@ describe('macro: footer', () => {
|
|
|
179
179
|
expect(licenseHtml).toContain(', except where otherwise stated');
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
it('renders welsh `post` content when `lang:cy` provided and `
|
|
182
|
+
it('renders welsh `post` content when `lang:cy` provided and `oglLink` is "true"', () => {
|
|
183
183
|
const $ = cheerio.load(
|
|
184
184
|
renderComponent('footer', {
|
|
185
185
|
lang: 'cy',
|
|
186
|
-
|
|
186
|
+
oglLink: true,
|
|
187
187
|
}),
|
|
188
188
|
);
|
|
189
189
|
|
|
@@ -354,8 +354,8 @@ describe('macro: footer', () => {
|
|
|
354
354
|
});
|
|
355
355
|
});
|
|
356
356
|
|
|
357
|
-
describe('
|
|
358
|
-
describe('default
|
|
357
|
+
describe('Footer logo', () => {
|
|
358
|
+
describe('default footer logo', () => {
|
|
359
359
|
describe.each([
|
|
360
360
|
[
|
|
361
361
|
'the `lang` parameter is not provided',
|
|
@@ -387,7 +387,7 @@ describe('macro: footer', () => {
|
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
});
|
|
390
|
-
describe('provided
|
|
390
|
+
describe('provided footer logo', () => {
|
|
391
391
|
describe.each([
|
|
392
392
|
[
|
|
393
393
|
'the `lang` parameter is "cy"',
|
|
@@ -415,54 +415,74 @@ describe('macro: footer', () => {
|
|
|
415
415
|
it('has the Welsh lang link when the default Welsh lang ons icon is present', () => {
|
|
416
416
|
const $ = cheerio.load(renderComponent('footer', { lang: 'cy' }));
|
|
417
417
|
|
|
418
|
-
expect($('.ons-
|
|
418
|
+
expect($('.ons-footer__logo-link').attr('href')).toBe('https://cy.ons.gov.uk/');
|
|
419
419
|
});
|
|
420
420
|
it('has the English lang link when the default English lang ons icon is present', () => {
|
|
421
421
|
const $ = cheerio.load(renderComponent('footer', { lang: 'en' }));
|
|
422
422
|
|
|
423
|
-
expect($('.ons-
|
|
423
|
+
expect($('.ons-footer__logo-link').attr('href')).toBe('https://www.ons.gov.uk/');
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
|
-
describe('provided
|
|
426
|
+
describe('provided footer logo', () => {
|
|
427
427
|
describe.each([
|
|
428
428
|
[
|
|
429
|
-
'the `
|
|
429
|
+
'the `footerLogo` and `oglLink` parameters are provided',
|
|
430
430
|
{
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
footerLogo: {
|
|
432
|
+
logos: {
|
|
433
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
oglLink: EXAMPLE_OGL_LINK_PARAM,
|
|
433
437
|
},
|
|
434
438
|
],
|
|
435
439
|
[
|
|
436
|
-
'the `
|
|
440
|
+
'the `footerLogo` and `legal` parameters are provided',
|
|
437
441
|
{
|
|
438
|
-
|
|
442
|
+
footerLogo: {
|
|
443
|
+
logos: {
|
|
444
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
445
|
+
},
|
|
446
|
+
},
|
|
439
447
|
legal: EXAMPLE_LEGAL_PARAM,
|
|
440
448
|
},
|
|
441
449
|
],
|
|
442
450
|
[
|
|
443
|
-
'the `
|
|
451
|
+
'the `footerLogo` and `crest` parameters are provided',
|
|
444
452
|
{
|
|
445
|
-
|
|
453
|
+
footerLogo: {
|
|
454
|
+
logos: {
|
|
455
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
456
|
+
},
|
|
457
|
+
},
|
|
446
458
|
crest: true,
|
|
447
459
|
},
|
|
448
460
|
],
|
|
449
461
|
[
|
|
450
|
-
'the `
|
|
462
|
+
'the `footerLogo`, `legal` and `crest` parameters are provided',
|
|
451
463
|
{
|
|
452
|
-
|
|
464
|
+
footerLogo: {
|
|
465
|
+
logos: {
|
|
466
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
467
|
+
},
|
|
468
|
+
},
|
|
453
469
|
legal: EXAMPLE_LEGAL_PARAM,
|
|
454
470
|
crest: true,
|
|
455
471
|
},
|
|
456
472
|
],
|
|
457
473
|
[
|
|
458
|
-
'the `
|
|
474
|
+
'the `footerLogo` parameter is provided but the `legal` and `crest` parameters are not provided',
|
|
459
475
|
{
|
|
460
|
-
|
|
476
|
+
footerLogo: {
|
|
477
|
+
logos: {
|
|
478
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
479
|
+
},
|
|
480
|
+
},
|
|
461
481
|
},
|
|
462
482
|
],
|
|
463
|
-
])('where %s', (_,
|
|
483
|
+
])('where %s', (_, footerLogoParams) => {
|
|
464
484
|
const params = {
|
|
465
|
-
...
|
|
485
|
+
...footerLogoParams,
|
|
466
486
|
};
|
|
467
487
|
|
|
468
488
|
it('passes jest-axe checks', async () => {
|
|
@@ -478,6 +498,48 @@ describe('macro: footer', () => {
|
|
|
478
498
|
expect($('.custom-logo').length).toBe(1);
|
|
479
499
|
});
|
|
480
500
|
});
|
|
501
|
+
|
|
502
|
+
it('has the extra footer logo image and link', () => {
|
|
503
|
+
const $ = cheerio.load(
|
|
504
|
+
renderComponent('footer', {
|
|
505
|
+
footerLogo: {
|
|
506
|
+
logos: {
|
|
507
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
508
|
+
logo2: {
|
|
509
|
+
logoUrl: '#0',
|
|
510
|
+
logoImage: '<img src="a-logo.svg">',
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
legal: EXAMPLE_LEGAL_PARAM,
|
|
515
|
+
crest: true,
|
|
516
|
+
}),
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
expect($('.ons-footer__logo-link').attr('href')).toBe('#0');
|
|
520
|
+
expect($('.ons-footer__logo-link > img').attr('src')).toBe('a-logo.svg');
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
it('has the correct class applied for opposite display of logos', () => {
|
|
524
|
+
const $ = cheerio.load(
|
|
525
|
+
renderComponent('footer', {
|
|
526
|
+
footerLogo: {
|
|
527
|
+
logos: {
|
|
528
|
+
logo1: { logoImage: '<img src="logo.svg" class="custom-logo" alt="logo">' },
|
|
529
|
+
logo2: {
|
|
530
|
+
logoUrl: '#0',
|
|
531
|
+
logoImage: '<img src="a-logo.svg">',
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
display: 'split',
|
|
535
|
+
},
|
|
536
|
+
legal: EXAMPLE_LEGAL_PARAM,
|
|
537
|
+
crest: true,
|
|
538
|
+
}),
|
|
539
|
+
);
|
|
540
|
+
|
|
541
|
+
expect($('.ons-footer__logo-container').attr('class')).toContain('ons-grid-flex--between');
|
|
542
|
+
});
|
|
481
543
|
});
|
|
482
544
|
});
|
|
483
545
|
|