@ons/design-system 52.0.0 → 53.0.2
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/button/_button.scss +75 -33
- package/components/button/_macro.njk +1 -1
- package/components/button/_macro.spec.js +2 -2
- package/components/external-link/_macro.njk +5 -2
- package/components/external-link/_macro.spec.js +18 -1
- package/components/footer/_footer.scss +19 -4
- package/components/footer/_macro.njk +108 -98
- package/components/footer/_macro.spec.js +131 -2
- package/components/header/_header.scss +65 -46
- package/components/header/_macro.njk +172 -120
- package/components/header/_macro.spec.js +85 -29
- package/components/hero/_hero.scss +30 -140
- package/components/hero/_macro.njk +13 -20
- package/components/hero/_macro.spec.js +32 -29
- package/components/icons/_macro.njk +257 -29
- package/components/icons/_macro.spec.js +6 -6
- package/components/input/_input.scss +8 -0
- package/components/language-selector/_macro.njk +1 -1
- package/components/language-selector/_macro.spec.js +9 -1
- package/components/navigation/_macro.njk +42 -35
- package/components/navigation/_macro.spec.js +34 -32
- package/components/navigation/_navigation.scss +20 -4
- package/components/related-content/_macro.njk +13 -21
- package/components/related-content/_macro.spec.js +18 -27
- package/components/related-content/_section-macro.njk +10 -0
- package/components/related-content/_section-macro.spec.js +43 -0
- package/components/share-page/_macro.njk +4 -2
- package/css/census.css +3 -1
- package/css/ids.css +2 -0
- package/css/main.css +1 -1
- package/img/dummy-brand-logo.svg +1 -0
- package/layout/_template.njk +9 -4
- package/package.json +1 -1
- package/scripts/main.es5.js +2 -2
- package/scss/ids.scss +2 -0
- package/scss/settings/_census.scss +141 -0
- package/scss/settings/_ids.scss +48 -0
- package/scss/utilities/_margin.scss +1 -0
- package/scss/vars/_colors.scss +5 -2
|
@@ -11,6 +11,12 @@ const EXAMPLE_POWERED_BY_PARAM = {
|
|
|
11
11
|
alt: 'Person alt text',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM = {
|
|
15
|
+
logo: 'person',
|
|
16
|
+
alt: 'Person alt text',
|
|
17
|
+
partnership: 'Prefix text string',
|
|
18
|
+
};
|
|
19
|
+
|
|
14
20
|
const EXAMPLE_OGL_LINK_PARAM = {
|
|
15
21
|
pre: 'All content is available under the',
|
|
16
22
|
link: 'Open Government Licence v3.0',
|
|
@@ -165,6 +171,18 @@ describe('macro: footer', () => {
|
|
|
165
171
|
const licenseHtml = $('.ons-footer__license').html();
|
|
166
172
|
expect(licenseHtml).toContain(', except where otherwise stated');
|
|
167
173
|
});
|
|
174
|
+
|
|
175
|
+
it('renders welsh `post` content when `lang:cy` provided and `OGLLink` is "true"', () => {
|
|
176
|
+
const $ = cheerio.load(
|
|
177
|
+
renderComponent('footer', {
|
|
178
|
+
lang: 'cy',
|
|
179
|
+
OGLLink: true,
|
|
180
|
+
}),
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const licenseHtml = $('.ons-footer__license').html();
|
|
184
|
+
expect(licenseHtml).toContain(', oni bai y nodir fel arall');
|
|
185
|
+
});
|
|
168
186
|
});
|
|
169
187
|
|
|
170
188
|
describe('warning', () => {
|
|
@@ -368,6 +386,17 @@ describe('macro: footer', () => {
|
|
|
368
386
|
altText: 'Person alt text',
|
|
369
387
|
},
|
|
370
388
|
],
|
|
389
|
+
[
|
|
390
|
+
'the `poweredBy.partnership` and `OGLLink` parameters are provided',
|
|
391
|
+
{
|
|
392
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
393
|
+
OGLLink: EXAMPLE_OGL_LINK_PARAM,
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
iconType: 'person',
|
|
397
|
+
altText: 'Person alt text',
|
|
398
|
+
},
|
|
399
|
+
],
|
|
371
400
|
[
|
|
372
401
|
'the `poweredBy` parameter is not provided but the `legal` parameter is provided',
|
|
373
402
|
{
|
|
@@ -394,6 +423,17 @@ describe('macro: footer', () => {
|
|
|
394
423
|
altText: 'Person alt text',
|
|
395
424
|
},
|
|
396
425
|
],
|
|
426
|
+
[
|
|
427
|
+
'the `poweredBy.partnership` and `legal` parameters are provided',
|
|
428
|
+
{
|
|
429
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
430
|
+
legal: EXAMPLE_LEGAL_PARAM,
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
iconType: 'person',
|
|
434
|
+
altText: 'Person alt text',
|
|
435
|
+
},
|
|
436
|
+
],
|
|
397
437
|
[
|
|
398
438
|
'the `poweredBy` and `crest` parameters are provided',
|
|
399
439
|
{
|
|
@@ -405,6 +445,17 @@ describe('macro: footer', () => {
|
|
|
405
445
|
altText: 'Person alt text',
|
|
406
446
|
},
|
|
407
447
|
],
|
|
448
|
+
[
|
|
449
|
+
'the `poweredBy.partnership` and `crest` parameters are provided',
|
|
450
|
+
{
|
|
451
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
452
|
+
crest: true,
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
iconType: 'person',
|
|
456
|
+
altText: 'Person alt text',
|
|
457
|
+
},
|
|
458
|
+
],
|
|
408
459
|
[
|
|
409
460
|
'the `poweredBy`, `legal` and `crest` parameters are provided',
|
|
410
461
|
{
|
|
@@ -418,7 +469,19 @@ describe('macro: footer', () => {
|
|
|
418
469
|
},
|
|
419
470
|
],
|
|
420
471
|
[
|
|
421
|
-
'the `poweredBy
|
|
472
|
+
'the `poweredBy.partnership`, `legal` and `crest` parameters are provided',
|
|
473
|
+
{
|
|
474
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
475
|
+
legal: EXAMPLE_LEGAL_PARAM,
|
|
476
|
+
crest: true,
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
iconType: 'person',
|
|
480
|
+
altText: 'Person alt text',
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
[
|
|
484
|
+
'the `poweredBy` parameter is provided but the `legal` and `crest` parameters are not provided',
|
|
422
485
|
{
|
|
423
486
|
poweredBy: EXAMPLE_POWERED_BY_PARAM,
|
|
424
487
|
},
|
|
@@ -427,6 +490,16 @@ describe('macro: footer', () => {
|
|
|
427
490
|
altText: 'Person alt text',
|
|
428
491
|
},
|
|
429
492
|
],
|
|
493
|
+
[
|
|
494
|
+
'the `poweredBy.partnership` parameter is provided but the `legal` and `crest` parameters are not provided',
|
|
495
|
+
{
|
|
496
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
iconType: 'person',
|
|
500
|
+
altText: 'Person alt text',
|
|
501
|
+
},
|
|
502
|
+
],
|
|
430
503
|
])('where %s', (_, poweredByParams, expectedIcon) => {
|
|
431
504
|
const params = {
|
|
432
505
|
...langParams,
|
|
@@ -531,7 +604,7 @@ describe('macro: footer', () => {
|
|
|
531
604
|
expect(results).toHaveNoViolations();
|
|
532
605
|
});
|
|
533
606
|
|
|
534
|
-
it('renders crest icon when `crest` parameter is
|
|
607
|
+
it('renders crest icon when `crest` parameter is provided', () => {
|
|
535
608
|
const faker = templateFaker();
|
|
536
609
|
const iconsSpy = faker.spy('icons');
|
|
537
610
|
|
|
@@ -546,4 +619,60 @@ describe('macro: footer', () => {
|
|
|
546
619
|
expect($('.ons-footer__crest').length).toBe(1);
|
|
547
620
|
});
|
|
548
621
|
});
|
|
622
|
+
|
|
623
|
+
describe('partnership', () => {
|
|
624
|
+
const params = {
|
|
625
|
+
poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
it('passes jest-axe checks', async () => {
|
|
629
|
+
const $ = cheerio.load(renderComponent('footer', params));
|
|
630
|
+
|
|
631
|
+
const results = await axe($.html());
|
|
632
|
+
expect(results).toHaveNoViolations();
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
it('renders ONS icon when `partnership` parameter is provided', () => {
|
|
636
|
+
const faker = templateFaker();
|
|
637
|
+
const iconsSpy = faker.spy('icons');
|
|
638
|
+
|
|
639
|
+
faker.renderComponent('footer', params);
|
|
640
|
+
|
|
641
|
+
expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining({ iconType: 'ons-logo-en' }));
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
it('renders "poweredBy" icon when `partnership` parameter is provided', () => {
|
|
645
|
+
const faker = templateFaker();
|
|
646
|
+
const iconsSpy = faker.spy('icons');
|
|
647
|
+
|
|
648
|
+
faker.renderComponent('footer', params);
|
|
649
|
+
|
|
650
|
+
expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining({ iconType: 'person' }));
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
it('renders "poweredBy" element when `partnership` parameter is provided', () => {
|
|
654
|
+
const $ = cheerio.load(renderComponent('footer', params));
|
|
655
|
+
|
|
656
|
+
expect($('.ons-footer__poweredby').length).toBe(1);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
it('renders "partnership" and "prefix" elements when `partnership` parameter is provided', () => {
|
|
660
|
+
const $ = cheerio.load(renderComponent('footer', params));
|
|
661
|
+
|
|
662
|
+
expect($('.ons-footer__partnership').length).toBe(1);
|
|
663
|
+
expect($('.ons-footer__partnership-prefix').length).toBe(1);
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
it('does not render "partnership" element when `partnership` parameter is not provided', () => {
|
|
667
|
+
const params = {
|
|
668
|
+
poweredBy: {
|
|
669
|
+
logo: 'person',
|
|
670
|
+
alt: 'Person alt text',
|
|
671
|
+
},
|
|
672
|
+
};
|
|
673
|
+
const $ = cheerio.load(renderComponent('footer', params));
|
|
674
|
+
|
|
675
|
+
expect($('.ons-footer__partnership').length).toBe(0);
|
|
676
|
+
});
|
|
677
|
+
});
|
|
549
678
|
});
|
|
@@ -6,21 +6,9 @@
|
|
|
6
6
|
margin: 0;
|
|
7
7
|
position: relative;
|
|
8
8
|
|
|
9
|
-
& &__title--svg-logo {
|
|
10
|
-
display: block;
|
|
11
|
-
fill: $color-white;
|
|
12
|
-
|
|
13
|
-
@include mq(m) {
|
|
14
|
-
margin: 0.84rem 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@include mq(xxs, 399px) {
|
|
18
|
-
max-width: 160px;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
9
|
// Elements
|
|
22
10
|
&__top {
|
|
23
|
-
background: $color-header-
|
|
11
|
+
background: $color-header-masthead;
|
|
24
12
|
width: 100%;
|
|
25
13
|
}
|
|
26
14
|
&__grid-top {
|
|
@@ -56,20 +44,10 @@
|
|
|
56
44
|
margin-top: 0.8rem;
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
//to allow for differences in size between welsh and english logos
|
|
60
|
-
&-census-logo-en {
|
|
61
|
-
@include mq(xxs) {
|
|
62
|
-
margin: 0.19rem 0 0.2rem;
|
|
63
|
-
padding: 0.25rem 0;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
47
|
&-link {
|
|
67
48
|
display: block;
|
|
68
49
|
text-decoration: none;
|
|
69
50
|
&:focus {
|
|
70
|
-
.ons-header__title--svg-logo {
|
|
71
|
-
fill: $color-text-link-focus;
|
|
72
|
-
}
|
|
73
51
|
.ons-header__title {
|
|
74
52
|
color: $color-text-link-focus;
|
|
75
53
|
}
|
|
@@ -78,11 +56,6 @@
|
|
|
78
56
|
text-decoration: underline solid $color-text-inverse-link 2px;
|
|
79
57
|
}
|
|
80
58
|
}
|
|
81
|
-
&--nav-adj {
|
|
82
|
-
@include mq(399px) {
|
|
83
|
-
padding-top: 0.2rem;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
59
|
}
|
|
87
60
|
&__description {
|
|
88
61
|
@extend .ons-u-fs-s;
|
|
@@ -106,9 +79,11 @@
|
|
|
106
79
|
}
|
|
107
80
|
}
|
|
108
81
|
}
|
|
109
|
-
|
|
82
|
+
|
|
83
|
+
&--internal &,
|
|
84
|
+
&--neutral & {
|
|
110
85
|
&__top {
|
|
111
|
-
background: $color-header-
|
|
86
|
+
background: $color-header-masthead-internal;
|
|
112
87
|
.ons-svg-logo {
|
|
113
88
|
display: block;
|
|
114
89
|
.ons-svg-logo__group--text,
|
|
@@ -117,7 +92,7 @@
|
|
|
117
92
|
}
|
|
118
93
|
}
|
|
119
94
|
}
|
|
120
|
-
&
|
|
95
|
+
&__org-logo-link:focus {
|
|
121
96
|
background-color: transparent;
|
|
122
97
|
box-shadow: none;
|
|
123
98
|
outline: 3px solid $color-focus;
|
|
@@ -136,40 +111,72 @@
|
|
|
136
111
|
}
|
|
137
112
|
}
|
|
138
113
|
|
|
114
|
+
&--neutral & {
|
|
115
|
+
&__top {
|
|
116
|
+
background: $color-header-masthead-dark;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__main {
|
|
120
|
+
background: $color-header-light;
|
|
121
|
+
|
|
122
|
+
&--border {
|
|
123
|
+
border-bottom: 3px solid $color-header-light;
|
|
124
|
+
border-top: 3px solid $color-header-light;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&__title {
|
|
129
|
+
color: $color-branded-text;
|
|
130
|
+
&-link {
|
|
131
|
+
&:hover {
|
|
132
|
+
text-decoration: underline solid $color-branded-text 2px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
139
138
|
.ons-svg-logo {
|
|
140
139
|
display: block;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
&
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
&__org-logo-link,
|
|
143
|
+
&__title-logo-link {
|
|
144
|
+
display: block;
|
|
145
|
+
&:focus {
|
|
146
|
+
.ons-svg-logo {
|
|
146
147
|
fill: $color-black !important;
|
|
148
|
+
.ons-svg-logo__group {
|
|
149
|
+
fill: $color-black !important;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
&:hover {
|
|
154
|
+
font-size: 0;
|
|
155
|
+
text-decoration: none;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&__title-logo--large {
|
|
160
|
+
.ons-svg-logo {
|
|
161
|
+
@include mq(xxs, 399px) {
|
|
162
|
+
height: auto;
|
|
163
|
+
max-width: 160px;
|
|
147
164
|
}
|
|
148
165
|
}
|
|
149
166
|
}
|
|
150
167
|
|
|
151
|
-
|
|
168
|
+
&__org-logo--large {
|
|
152
169
|
@include mq(xxs, 454px) {
|
|
153
170
|
display: none;
|
|
154
171
|
}
|
|
155
172
|
}
|
|
156
173
|
|
|
157
|
-
|
|
174
|
+
&__org-logo--small {
|
|
158
175
|
@include mq(455px) {
|
|
159
176
|
display: none;
|
|
160
177
|
}
|
|
161
178
|
}
|
|
162
179
|
|
|
163
|
-
&__logo-link,
|
|
164
|
-
&__logo-link:hover {
|
|
165
|
-
font-size: 0;
|
|
166
|
-
text-decoration: none;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&__logo-link {
|
|
170
|
-
display: block;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
180
|
&-service-nav {
|
|
174
181
|
display: inline-block;
|
|
175
182
|
|
|
@@ -179,6 +186,12 @@
|
|
|
179
186
|
width: 100%;
|
|
180
187
|
}
|
|
181
188
|
|
|
189
|
+
.ons-header--neutral & {
|
|
190
|
+
&--mobile {
|
|
191
|
+
background: $color-grey-5;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
182
195
|
&__list {
|
|
183
196
|
list-style: none;
|
|
184
197
|
margin: 0;
|
|
@@ -207,4 +220,10 @@
|
|
|
207
220
|
}
|
|
208
221
|
}
|
|
209
222
|
}
|
|
223
|
+
&__lang-adjustment {
|
|
224
|
+
@include mq(l) {
|
|
225
|
+
margin-right: 21rem;
|
|
226
|
+
margin-top: -5px !important;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
210
229
|
}
|