@ons/design-system 74.0.0-next.4 → 74.0.0-next.5
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.
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
{% endfor %}
|
|
22
22
|
</div>
|
|
23
23
|
{% endif %}
|
|
24
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class="ons-hero__container ons-container{{ ' ons-container--wide' if params.wide }}{{ ' ons-container--full-width' if params.fullWidth }}"
|
|
26
|
+
>
|
|
25
27
|
<div class="ons-hero__details ons-grid__col ons-col-{{ detailsColumns }}@m col-10@s@m">
|
|
26
28
|
<div class="ons-hero__content">
|
|
27
29
|
<div class="ons-hero__title-container">
|
|
@@ -44,7 +46,6 @@
|
|
|
44
46
|
{% elif params.richText %}
|
|
45
47
|
<div class="ons-hero__richtext">{{ params.richText | safe }}</div>
|
|
46
48
|
{% endif %}
|
|
47
|
-
|
|
48
49
|
</div>
|
|
49
50
|
|
|
50
51
|
{% if params.variants == "grey" and params.officialStatisticsBadge == true %}
|
|
@@ -34,6 +34,42 @@ describe('macro: hero', () => {
|
|
|
34
34
|
expect($('.ons-hero--variant-b').length).toBe(1);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
it('has the `ons-container--wide` class on the container when `wide` is true', () => {
|
|
38
|
+
const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, wide: true }));
|
|
39
|
+
|
|
40
|
+
expect($('.ons-hero__container').hasClass('ons-container--wide')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('does not have the `ons-container--wide` class on the container when `wide` is false', () => {
|
|
44
|
+
const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, wide: false }));
|
|
45
|
+
|
|
46
|
+
expect($('.ons-hero__container').hasClass('ons-container--wide')).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('does not have the `ons-container--wide` class on the container when `wide` is not set', () => {
|
|
50
|
+
const $ = cheerio.load(renderComponent('hero', EXAMPLE_HERO));
|
|
51
|
+
|
|
52
|
+
expect($('.ons-hero__container').hasClass('ons-container--wide')).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('has the `ons-container--full-width` class on the container when `fullWidth` is true', () => {
|
|
56
|
+
const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, fullWidth: true }));
|
|
57
|
+
|
|
58
|
+
expect($('.ons-hero__container').hasClass('ons-container--full-width')).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('does not have the `ons-container--full-width` class on the container when `fullWidth` is false', () => {
|
|
62
|
+
const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, fullWidth: false }));
|
|
63
|
+
|
|
64
|
+
expect($('.ons-hero__container').hasClass('ons-container--full-width')).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('does not have the `ons-container--full-width` class on the container when `fullWidth` is not set', () => {
|
|
68
|
+
const $ = cheerio.load(renderComponent('hero', EXAMPLE_HERO));
|
|
69
|
+
|
|
70
|
+
expect($('.ons-hero__container').hasClass('ons-container--full-width')).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
|
|
37
73
|
it('has expected `title`', () => {
|
|
38
74
|
const $ = cheerio.load(renderComponent('hero', EXAMPLE_HERO));
|
|
39
75
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
'fullWidth': true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
{% from "components/hero/_macro.njk" import onsHero %}
|
|
6
|
+
{{
|
|
7
|
+
onsHero({
|
|
8
|
+
"title": 'Design and build digital services for the ONS',
|
|
9
|
+
"text": 'Everything you need to make accessible, consistent digital products',
|
|
10
|
+
"button": {
|
|
11
|
+
"url": '#0',
|
|
12
|
+
"text": 'Get started'
|
|
13
|
+
},
|
|
14
|
+
"variants": 'dark',
|
|
15
|
+
"wide": true
|
|
16
|
+
})
|
|
17
|
+
}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
'fullWidth': true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
{% from "components/hero/_macro.njk" import onsHero %}
|
|
6
|
+
{{
|
|
7
|
+
onsHero({
|
|
8
|
+
"title": 'Design and build digital services for the ONS',
|
|
9
|
+
"text": 'Everything you need to make accessible, consistent digital products',
|
|
10
|
+
"button": {
|
|
11
|
+
"url": '#0',
|
|
12
|
+
"text": 'Get started'
|
|
13
|
+
},
|
|
14
|
+
"fullWidth": true
|
|
15
|
+
})
|
|
16
|
+
}}
|