@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
|
@@ -7,9 +7,8 @@ $button-shadow-size: 3px;
|
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
display: inline-block;
|
|
9
9
|
font-family: inherit;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
line-height: 1.35;
|
|
10
|
+
@extend .ons-u-fs-r--b;
|
|
11
|
+
|
|
13
12
|
margin: 0;
|
|
14
13
|
padding: 0;
|
|
15
14
|
position: relative;
|
|
@@ -38,19 +37,17 @@ $button-shadow-size: 3px;
|
|
|
38
37
|
&__inner {
|
|
39
38
|
background: var(--ons-color-button);
|
|
40
39
|
border-radius: $input-radius;
|
|
41
|
-
box-shadow: 0
|
|
40
|
+
box-shadow: 0 rems($button-shadow-size) 0 var(--ons-color-button-shadow);
|
|
42
41
|
color: var(--ons-color-text-inverse);
|
|
43
|
-
display:
|
|
44
|
-
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
padding: 0.75rem 1rem;
|
|
45
45
|
// Required for Google Tag Manager
|
|
46
46
|
pointer-events: none;
|
|
47
47
|
position: relative;
|
|
48
|
-
|
|
49
48
|
.ons-icon {
|
|
50
49
|
fill: var(--ons-color-text-inverse);
|
|
51
50
|
height: 18px;
|
|
52
|
-
margin-top: -$button-shadow-size;
|
|
53
|
-
vertical-align: middle;
|
|
54
51
|
width: 18px;
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -106,12 +103,12 @@ $button-shadow-size: 3px;
|
|
|
106
103
|
// Small buttons
|
|
107
104
|
&--small,
|
|
108
105
|
&--mobile {
|
|
109
|
-
|
|
106
|
+
line-height: 1.25rem !important;
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
&--small & {
|
|
113
110
|
&__inner {
|
|
114
|
-
padding: 0.
|
|
111
|
+
padding: 0.5rem 0.75rem;
|
|
115
112
|
.ons-icon {
|
|
116
113
|
height: 16px;
|
|
117
114
|
width: 16px;
|
|
@@ -122,7 +119,7 @@ $button-shadow-size: 3px;
|
|
|
122
119
|
&--small.ons-btn--ghost &,
|
|
123
120
|
&--mobile & {
|
|
124
121
|
&__inner {
|
|
125
|
-
padding: 0.
|
|
122
|
+
padding: 0.5rem 0.75rem;
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
125
|
|
|
@@ -391,6 +388,9 @@ $button-shadow-size: 3px;
|
|
|
391
388
|
transition: opacity 0.3s ease-in-out;
|
|
392
389
|
width: 27px;
|
|
393
390
|
}
|
|
391
|
+
.ons-btn__text {
|
|
392
|
+
margin-left: 0;
|
|
393
|
+
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
|
|
@@ -405,7 +405,8 @@ $button-shadow-size: 3px;
|
|
|
405
405
|
&__inner {
|
|
406
406
|
color: transparent;
|
|
407
407
|
.ons-icon {
|
|
408
|
-
|
|
408
|
+
@extend .ons-u-ml-no;
|
|
409
|
+
|
|
409
410
|
opacity: 1;
|
|
410
411
|
}
|
|
411
412
|
}
|
|
@@ -482,7 +483,6 @@ $button-shadow-size: 3px;
|
|
|
482
483
|
box-shadow: none;
|
|
483
484
|
color: var(--ons-color-branded-text);
|
|
484
485
|
display: block;
|
|
485
|
-
font-size: 1rem;
|
|
486
486
|
font-weight: $font-weight-regular;
|
|
487
487
|
padding: 0.6rem 1rem;
|
|
488
488
|
text-align: left;
|
|
@@ -490,7 +490,7 @@ $button-shadow-size: 3px;
|
|
|
490
490
|
.ons-icon {
|
|
491
491
|
fill: var(--ons-color-branded-text);
|
|
492
492
|
float: right;
|
|
493
|
-
margin-top:
|
|
493
|
+
margin-top: 0.25rem;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
}
|
|
@@ -552,8 +552,16 @@ $button-shadow-size: 3px;
|
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
+
.ons-search__btn {
|
|
556
|
+
height: 92.5%; //this is to allow the button to be fully aligned with the input by accounting for the shadow box of 3px
|
|
557
|
+
.ons-btn__inner:has(> .ons-icon) {
|
|
558
|
+
padding-right: 0.75rem;
|
|
559
|
+
height: 100%;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
555
563
|
.ons-btn-group {
|
|
556
|
-
@extend .ons-u-mb-
|
|
564
|
+
@extend .ons-u-mb-l;
|
|
557
565
|
|
|
558
566
|
align-items: baseline;
|
|
559
567
|
display: flex;
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
{{-
|
|
87
87
|
onsIcon({
|
|
88
88
|
"iconType": iconType,
|
|
89
|
-
"classes": 'ons-u-mr-
|
|
89
|
+
"classes": 'ons-u-mr-2xs'
|
|
90
90
|
})
|
|
91
91
|
-}}
|
|
92
92
|
{%- endif -%}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
{{-
|
|
96
96
|
onsIcon({
|
|
97
97
|
"iconType": iconType,
|
|
98
|
-
"classes": 'ons-u-ml-
|
|
98
|
+
"classes": 'ons-u-ml-2xs'
|
|
99
99
|
})
|
|
100
100
|
-}}
|
|
101
101
|
{%- endif -%}
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"iconType": iconType
|
|
106
106
|
})
|
|
107
107
|
-}}
|
|
108
|
-
<span class="ons-btn__text ons-u-vh@
|
|
108
|
+
<span class="ons-btn__text ons-u-vh@2xs@s">{{- params.html | safe if params.html else params.text -}}</span>
|
|
109
109
|
{%- else -%}
|
|
110
110
|
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
111
111
|
{%- endif -%}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
text-decoration-thickness: 3px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
&__title {
|
|
21
|
-
// This is to allow the focus state for multi lined title links to render the focus style correctly.
|
|
22
|
-
// This should be corrected when the typography scale is improved.
|
|
23
|
-
line-height: 1.65 !important;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
20
|
@include mq(m) {
|
|
27
21
|
margin: 0;
|
|
28
22
|
.ons-grid__col & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{%- macro onsCard(params) -%}
|
|
2
|
-
{% set headingLevel = params.headingLevel | default(2) | string %}
|
|
2
|
+
{% set headingLevel = params.title.headingLevel | default(2) | string %}
|
|
3
3
|
{% set openingHeadingTag = "<h" + headingLevel %}
|
|
4
4
|
{% set closingHeadingTag = "</h" + headingLevel + ">" %}
|
|
5
|
-
{% set placeholderSrcset = (params.image.
|
|
5
|
+
{% set placeholderSrcset = (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/large/placeholder-card.png 2x" %}
|
|
6
6
|
|
|
7
7
|
<div class="ons-card">
|
|
8
|
-
<a href="{{ params.url }}" class="ons-card__link">
|
|
8
|
+
<a href="{{ params.title.url }}" class="ons-card__link">
|
|
9
9
|
{%- if params.image -%}
|
|
10
10
|
{% if params.image.smallSrc %}
|
|
11
11
|
<img
|
|
@@ -17,31 +17,31 @@
|
|
|
17
17
|
alt="{{ params.image.alt }}"
|
|
18
18
|
loading="lazy"
|
|
19
19
|
/>
|
|
20
|
-
{% elif params.image == true or params.image.
|
|
20
|
+
{% elif params.image == true or params.image.placeholderUrl %}
|
|
21
21
|
<img
|
|
22
22
|
class="ons-card__image ons-u-mb-s "
|
|
23
23
|
height="100"
|
|
24
24
|
width="303"
|
|
25
25
|
srcset="{{ placeholderSrcset }}"
|
|
26
|
-
src="{{- params.image.
|
|
26
|
+
src="{{- params.image.placeholderUrl if params.image.placeholderUrl -}}/img/small/placeholder-card.png"
|
|
27
27
|
alt=""
|
|
28
28
|
loading="lazy"
|
|
29
29
|
/>
|
|
30
30
|
{% endif %}
|
|
31
31
|
{%- endif -%}
|
|
32
32
|
{{ openingHeadingTag | safe }}
|
|
33
|
-
class="ons-card__title {{ params.
|
|
33
|
+
class="ons-card__title {{ params.title.classes | default('ons-u-fs-m') }}" id="{{ params.title.id }}"> {{ params.title.text }}
|
|
34
34
|
{{ closingHeadingTag | safe }}
|
|
35
35
|
</a>
|
|
36
36
|
|
|
37
|
-
<p id="{{ params.
|
|
37
|
+
<p id="{{ params.body.id }}">{{ params.body.text }}</p>
|
|
38
38
|
|
|
39
|
-
{%- if params.itemsList -%}
|
|
39
|
+
{%- if params.body.itemsList -%}
|
|
40
40
|
{% from "components/list/_macro.njk" import onsList %}
|
|
41
41
|
{{
|
|
42
42
|
onsList({
|
|
43
43
|
"variants": 'dashed',
|
|
44
|
-
"itemsList": params.itemsList
|
|
44
|
+
"itemsList": params.body.itemsList
|
|
45
45
|
})
|
|
46
46
|
}}
|
|
47
47
|
{% endif %}
|
|
@@ -6,15 +6,17 @@ import axe from '../../tests/helpers/axe';
|
|
|
6
6
|
import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
7
7
|
|
|
8
8
|
const EXAMPLE_CARD_WITHOUT_IMAGE = {
|
|
9
|
-
title:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
title: {
|
|
10
|
+
text: 'Example card title',
|
|
11
|
+
},
|
|
12
|
+
body: {
|
|
13
|
+
text: 'Example card text.',
|
|
14
|
+
id: 'example-text-id',
|
|
15
|
+
},
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
const EXAMPLE_CARD_WITH_IMAGE = {
|
|
15
|
-
|
|
16
|
-
text: 'Example card text.',
|
|
17
|
-
textId: 'example-text-id',
|
|
19
|
+
...EXAMPLE_CARD_WITHOUT_IMAGE,
|
|
18
20
|
image: {
|
|
19
21
|
smallSrc: 'example-small.png',
|
|
20
22
|
largeSrc: 'example-large.png',
|
|
@@ -23,18 +25,14 @@ const EXAMPLE_CARD_WITH_IMAGE = {
|
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE = {
|
|
26
|
-
|
|
27
|
-
text: 'Example card text.',
|
|
28
|
-
textId: 'example-text-id',
|
|
28
|
+
...EXAMPLE_CARD_WITHOUT_IMAGE,
|
|
29
29
|
image: true,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH = {
|
|
33
|
-
|
|
34
|
-
text: 'Example card text.',
|
|
35
|
-
textId: 'example-text-id',
|
|
33
|
+
...EXAMPLE_CARD_WITHOUT_IMAGE,
|
|
36
34
|
image: {
|
|
37
|
-
|
|
35
|
+
placeholderUrl: '/placeholder-image-url',
|
|
38
36
|
},
|
|
39
37
|
};
|
|
40
38
|
|
|
@@ -59,8 +57,14 @@ describe('macro: card', () => {
|
|
|
59
57
|
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
|
|
60
58
|
const $ = cheerio.load(
|
|
61
59
|
renderComponent('card', {
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
title: {
|
|
61
|
+
text: 'Example card title',
|
|
62
|
+
headingLevel: headingLevel,
|
|
63
|
+
},
|
|
64
|
+
body: {
|
|
65
|
+
text: 'Example card text.',
|
|
66
|
+
id: 'example-text-id',
|
|
67
|
+
},
|
|
64
68
|
}),
|
|
65
69
|
);
|
|
66
70
|
|
|
@@ -78,8 +82,14 @@ describe('macro: card', () => {
|
|
|
78
82
|
const listsSpy = faker.spy('list');
|
|
79
83
|
|
|
80
84
|
faker.renderComponent('card', {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
title: {
|
|
86
|
+
text: 'Example card title',
|
|
87
|
+
},
|
|
88
|
+
body: {
|
|
89
|
+
text: 'Example card text.',
|
|
90
|
+
id: 'example-text-id',
|
|
91
|
+
itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
|
|
92
|
+
},
|
|
83
93
|
});
|
|
84
94
|
|
|
85
95
|
expect(listsSpy.occurrences[0]).toEqual({
|
|
@@ -91,8 +101,14 @@ describe('macro: card', () => {
|
|
|
91
101
|
it('outputs a hyperlink with the provided `url`', () => {
|
|
92
102
|
const $ = cheerio.load(
|
|
93
103
|
renderComponent('card', {
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
title: {
|
|
105
|
+
text: 'Example card title',
|
|
106
|
+
url: 'https://example.com',
|
|
107
|
+
},
|
|
108
|
+
body: {
|
|
109
|
+
text: 'Example card text.',
|
|
110
|
+
id: 'example-text-id',
|
|
111
|
+
},
|
|
96
112
|
}),
|
|
97
113
|
);
|
|
98
114
|
|
|
@@ -120,8 +136,19 @@ describe('macro: card', () => {
|
|
|
120
136
|
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
|
|
121
137
|
const $ = cheerio.load(
|
|
122
138
|
renderComponent('card', {
|
|
123
|
-
|
|
124
|
-
|
|
139
|
+
title: {
|
|
140
|
+
text: 'Example card title',
|
|
141
|
+
headingLevel: headingLevel,
|
|
142
|
+
},
|
|
143
|
+
body: {
|
|
144
|
+
text: 'Example card text.',
|
|
145
|
+
id: 'example-text-id',
|
|
146
|
+
},
|
|
147
|
+
image: {
|
|
148
|
+
smallSrc: 'example-small.png',
|
|
149
|
+
largeSrc: 'example-large.png',
|
|
150
|
+
alt: 'Example alt text',
|
|
151
|
+
},
|
|
125
152
|
}),
|
|
126
153
|
);
|
|
127
154
|
|
|
@@ -141,8 +168,14 @@ describe('macro: card', () => {
|
|
|
141
168
|
it('outputs a hyperlink with the provided `url`', () => {
|
|
142
169
|
const $ = cheerio.load(
|
|
143
170
|
renderComponent('card', {
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
title: {
|
|
172
|
+
text: 'Example card title',
|
|
173
|
+
url: 'https://example.com',
|
|
174
|
+
},
|
|
175
|
+
body: {
|
|
176
|
+
text: 'Example card text.',
|
|
177
|
+
id: 'example-text-id',
|
|
178
|
+
},
|
|
146
179
|
}),
|
|
147
180
|
);
|
|
148
181
|
|
|
@@ -206,7 +239,7 @@ describe('macro: card', () => {
|
|
|
206
239
|
});
|
|
207
240
|
});
|
|
208
241
|
|
|
209
|
-
describe('with a default placeholder image with `
|
|
242
|
+
describe('with a default placeholder image with `placeholderUrl`', () => {
|
|
210
243
|
it('outputs an `img` element', () => {
|
|
211
244
|
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
|
|
212
245
|
|
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
<div class="ons-grid__col ons-col-4@m">
|
|
5
5
|
{{
|
|
6
6
|
onsCard({
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
"image": true,
|
|
8
|
+
"title": {
|
|
9
|
+
"id": 'card-with-image-1',
|
|
10
|
+
"text": 'About the census',
|
|
11
|
+
"url": '#0'
|
|
12
|
+
},
|
|
13
|
+
"body":{
|
|
14
|
+
"text": 'The census is a survey that gives us information about all the households in England and Wales.',
|
|
15
|
+
"id": 'text1'
|
|
16
|
+
}
|
|
13
17
|
})
|
|
14
18
|
}}
|
|
15
19
|
</div>
|
|
@@ -17,12 +21,16 @@
|
|
|
17
21
|
<div class="ons-grid__col ons-col-4@m">
|
|
18
22
|
{{
|
|
19
23
|
onsCard({
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
"image": true,
|
|
25
|
+
"title": {
|
|
26
|
+
"id": 'card-with-image-2',
|
|
27
|
+
"text": 'Working on the census',
|
|
28
|
+
"url": '#0'
|
|
29
|
+
},
|
|
30
|
+
"body":{
|
|
31
|
+
"id": 'text2',
|
|
32
|
+
"text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.'
|
|
33
|
+
}
|
|
26
34
|
})
|
|
27
35
|
}}
|
|
28
36
|
</div>
|
|
@@ -30,12 +38,16 @@
|
|
|
30
38
|
<div class="ons-grid__col ons-col-4@m">
|
|
31
39
|
{{
|
|
32
40
|
onsCard({
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
"image": true,
|
|
42
|
+
"title": {
|
|
43
|
+
"id": 'card-with-image-3',
|
|
44
|
+
"text": 'Your data and security',
|
|
45
|
+
"url": '#0'
|
|
46
|
+
},
|
|
47
|
+
"body":{
|
|
48
|
+
"id": 'text3',
|
|
49
|
+
"text": 'How we keep your data safe and what happens to your personal information.'
|
|
50
|
+
}
|
|
39
51
|
})
|
|
40
52
|
}}
|
|
41
53
|
</div>
|
|
@@ -4,21 +4,25 @@
|
|
|
4
4
|
<div class="ons-grid__col ons-col-4@m">
|
|
5
5
|
{{
|
|
6
6
|
onsCard({
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
"title": {
|
|
8
|
+
"id": 'card-with-list-1',
|
|
9
|
+
"text": 'About the census',
|
|
10
|
+
"url": '#0'
|
|
11
|
+
},
|
|
12
|
+
"body":{
|
|
13
|
+
"id": 'text1',
|
|
14
|
+
"text": 'The census is a survey that gives us information about all the households in England and Wales.',
|
|
15
|
+
"itemsList": [
|
|
16
|
+
{
|
|
17
|
+
"url": '#0',
|
|
18
|
+
"text": 'List item 1 about the census'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"url": '#0',
|
|
22
|
+
"text": 'List item 2 about the census'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
22
26
|
})
|
|
23
27
|
}}
|
|
24
28
|
</div>
|
|
@@ -26,21 +30,25 @@
|
|
|
26
30
|
<div class="ons-grid__col ons-col-4@m">
|
|
27
31
|
{{
|
|
28
32
|
onsCard({
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
"title": {
|
|
34
|
+
"id": 'card-with-list-2',
|
|
35
|
+
"text": 'Working on the census',
|
|
36
|
+
"url": '#0'
|
|
37
|
+
},
|
|
38
|
+
"body":{
|
|
39
|
+
"id": 'text2',
|
|
40
|
+
"text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.',
|
|
41
|
+
"itemsList": [
|
|
42
|
+
{
|
|
43
|
+
"url": '#0',
|
|
44
|
+
"text": 'List item 1 about working on the census'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"url": '#0',
|
|
48
|
+
"text": 'List item 2 about working on the census'
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
44
52
|
})
|
|
45
53
|
}}
|
|
46
54
|
</div>
|
|
@@ -48,21 +56,25 @@
|
|
|
48
56
|
<div class="ons-grid__col ons-col-4@m">
|
|
49
57
|
{{
|
|
50
58
|
onsCard({
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
"title": {
|
|
60
|
+
"id": 'card-with-list-3',
|
|
61
|
+
"text": 'Your data and security',
|
|
62
|
+
"url": '#0'
|
|
63
|
+
},
|
|
64
|
+
"body":{
|
|
65
|
+
"id": 'text3',
|
|
66
|
+
"text": 'How we keep your data safe and what happens to your personal information.',
|
|
67
|
+
"itemsList": [
|
|
68
|
+
{
|
|
69
|
+
"url": '#0',
|
|
70
|
+
"text": 'List item 1 about your data and security'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"url": '#0',
|
|
74
|
+
"text": 'List item 2 about your data and security'
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
66
78
|
})
|
|
67
79
|
}}
|
|
68
80
|
</div>
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
<div class="ons-grid__col ons-col-4@m">
|
|
5
5
|
{{
|
|
6
6
|
onsCard({
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
"title": {
|
|
8
|
+
"id": 'card-set-1',
|
|
9
|
+
"text": 'About the census',
|
|
10
|
+
"url": '#0'
|
|
11
|
+
},
|
|
12
|
+
"body":{
|
|
13
|
+
"id": 'text1',
|
|
14
|
+
"text": 'The census is a survey that gives us information about all the households in England and Wales.'
|
|
15
|
+
}
|
|
12
16
|
})
|
|
13
17
|
}}
|
|
14
18
|
</div>
|
|
@@ -16,11 +20,15 @@
|
|
|
16
20
|
<div class="ons-grid__col ons-col-4@m">
|
|
17
21
|
{{
|
|
18
22
|
onsCard({
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
"title": {
|
|
24
|
+
"id": 'card-set-2',
|
|
25
|
+
"text": 'Working on the census',
|
|
26
|
+
"url": '#0'
|
|
27
|
+
},
|
|
28
|
+
"body":{
|
|
29
|
+
"id": 'text2',
|
|
30
|
+
"text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.'
|
|
31
|
+
}
|
|
24
32
|
})
|
|
25
33
|
}}
|
|
26
34
|
</div>
|
|
@@ -28,11 +36,15 @@
|
|
|
28
36
|
<div class="ons-grid__col ons-col-4@m">
|
|
29
37
|
{{
|
|
30
38
|
onsCard({
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
"title": {
|
|
40
|
+
"id": 'card-set-3',
|
|
41
|
+
"text": 'Your data and security',
|
|
42
|
+
"url": '#0'
|
|
43
|
+
},
|
|
44
|
+
"body":{
|
|
45
|
+
"id": 'text3',
|
|
46
|
+
"text": 'How we keep your data safe and what happens to your personal information.'
|
|
47
|
+
}
|
|
36
48
|
})
|
|
37
49
|
}}
|
|
38
50
|
</div>
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
{{
|
|
4
4
|
onsCard({
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
"title": {
|
|
6
|
+
"id": 'card-example',
|
|
7
|
+
"text": 'Your data and security',
|
|
8
|
+
"url": '#0'
|
|
9
|
+
},
|
|
10
|
+
"body":{
|
|
11
|
+
"id": 'text',
|
|
12
|
+
"text": 'How we keep your data safe and what happens to your personal information.'
|
|
13
|
+
}
|
|
10
14
|
})
|
|
11
15
|
}}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{% endif %}
|
|
6
6
|
<span
|
|
7
7
|
id="{{ params.id }}"
|
|
8
|
-
class="ons-input__limit ons-u-fs-s--b ons-u-d-no ons-u-mt-
|
|
8
|
+
class="ons-input__limit ons-u-fs-s--b ons-u-d-no ons-u-mt-2xs"
|
|
9
9
|
data-charcount-singular="{{ params.charCountSingular }}"
|
|
10
10
|
data-charcount-plural="{{ params.charCountPlural }}"
|
|
11
11
|
data-charcount-limit-singular="{{ params.charCountOverLimitSingular }}"
|