@ons/design-system 66.0.2 → 67.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/accordion/_macro.spec.js +2 -8
- package/components/accordion/accordion.dom.js +2 -2
- package/components/accordion/accordion.spec.js +22 -19
- package/components/accordion/example-accordion-open.njk +3 -3
- package/components/card/_card.scss +1 -1
- package/components/checkboxes/_macro.njk +1 -1
- package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +1 -1
- package/components/checkboxes/example-checkboxes-with-revealed-checkboxes.njk +1 -1
- package/components/cookies-banner/_macro.njk +1 -1
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +66 -57
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +3 -10
- package/components/details/details.dom.js +1 -1
- package/components/details/details.js +13 -1
- package/components/details/details.spec.js +43 -11
- package/components/details/example-details-with-warning.njk +1 -2
- package/components/footer/_macro.njk +1 -1
- package/components/header/_macro.spec.js +128 -5
- package/components/header/example-header-external-with-navigation-and-search.njk +57 -0
- package/components/label/_macro.njk +2 -2
- package/components/navigation/_macro.njk +3 -1
- package/components/related-content/_macro.njk +28 -30
- package/components/section-navigation/_macro.njk +56 -55
- package/components/video/_macro.njk +11 -11
- package/css/main.css +1 -1
- package/css/print.css +1 -1
- package/layout/_template.njk +29 -30
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/objects/_page.scss +3 -5
- package/scss/print.scss +28 -5
- package/components/collapsible/_macro.njk +0 -22
- package/components/collapsible/_macro.spec.js +0 -151
|
@@ -161,6 +161,45 @@ const EXAMPLE_HEADER_NAVIGATION_WITH_SUBNAVIGATION_CONFIG = {
|
|
|
161
161
|
},
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
+
const EXAMPLE_HEADER_NAVIGATION_WITH_SITESEARCHAUTOSUGGEST = {
|
|
165
|
+
navigation: {
|
|
166
|
+
id: 'main-nav',
|
|
167
|
+
ariaLabel: 'Main menu',
|
|
168
|
+
currentPath: '#home',
|
|
169
|
+
itemsList: [
|
|
170
|
+
{
|
|
171
|
+
title: 'Home',
|
|
172
|
+
url: '#home',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
title: 'Guidance',
|
|
176
|
+
url: '#0',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
toggleNavigationButton: {
|
|
180
|
+
text: 'Menu',
|
|
181
|
+
ariaLabel: 'Toggle main menu',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
siteSearchAutosuggest: {
|
|
185
|
+
label: 'label',
|
|
186
|
+
instructions: 'Use up and down keys to navigate.',
|
|
187
|
+
ariaYouHaveSelected: 'You have selected',
|
|
188
|
+
ariaMinChars: 'Enter 3 or more characters for suggestions.',
|
|
189
|
+
minChars: 3,
|
|
190
|
+
ariaResultsLabel: 'Country suggestions',
|
|
191
|
+
ariaOneResult: 'There is one suggestion available.',
|
|
192
|
+
ariaNResults: 'There are {n} suggestions available.',
|
|
193
|
+
ariaLimitedResults: 'Type more characters to improve your search',
|
|
194
|
+
moreResults: 'Continue entering to improve suggestions',
|
|
195
|
+
resultsTitle: 'Suggestions',
|
|
196
|
+
resultsTitleId: 'country-of-birth-suggestions',
|
|
197
|
+
noResults: 'No suggestions found.',
|
|
198
|
+
typeMore: 'Continue entering to get suggestions',
|
|
199
|
+
language: 'en-gb',
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
164
203
|
describe('macro: header', () => {
|
|
165
204
|
describe('mode: basic', () => {
|
|
166
205
|
it('passes jest-axe checks', async () => {
|
|
@@ -453,21 +492,21 @@ describe('macro: header', () => {
|
|
|
453
492
|
it('has the text for each list item', () => {
|
|
454
493
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LIST_ITEMS));
|
|
455
494
|
|
|
456
|
-
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__item'), node => node.text().trim());
|
|
495
|
+
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__item'), (node) => node.text().trim());
|
|
457
496
|
expect(values).toEqual(['Title 1', 'Title 2', 'Title 3']);
|
|
458
497
|
});
|
|
459
498
|
|
|
460
499
|
it('has the link text for each list item', () => {
|
|
461
500
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE));
|
|
462
501
|
|
|
463
|
-
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__link'), node => node.text().trim());
|
|
502
|
+
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__link'), (node) => node.text().trim());
|
|
464
503
|
expect(values).toEqual(['Title 1', 'Title 2', 'Title 3']);
|
|
465
504
|
});
|
|
466
505
|
|
|
467
506
|
it('has the link href for each list item', () => {
|
|
468
507
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE));
|
|
469
508
|
|
|
470
|
-
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__link'), node => node.attr('href'));
|
|
509
|
+
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__link'), (node) => node.attr('href'));
|
|
471
510
|
expect(values).toEqual(['#1', '#2', '#3']);
|
|
472
511
|
});
|
|
473
512
|
|
|
@@ -486,14 +525,14 @@ describe('macro: header', () => {
|
|
|
486
525
|
it('has the link text for each list item for mobile', () => {
|
|
487
526
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE));
|
|
488
527
|
|
|
489
|
-
const values = mapAll($('.ons-header-service-nav--mobile .ons-header-service-nav__link'), node => node.text().trim());
|
|
528
|
+
const values = mapAll($('.ons-header-service-nav--mobile .ons-header-service-nav__link'), (node) => node.text().trim());
|
|
490
529
|
expect(values).toEqual(['Title 1', 'Title 2', 'Title 3']);
|
|
491
530
|
});
|
|
492
531
|
|
|
493
532
|
it('has the link href for each list item for mobile', () => {
|
|
494
533
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE));
|
|
495
534
|
|
|
496
|
-
const values = mapAll($('.ons-header-service-nav--mobile .ons-header-service-nav__link'), node => node.attr('href'));
|
|
535
|
+
const values = mapAll($('.ons-header-service-nav--mobile .ons-header-service-nav__link'), (node) => node.attr('href'));
|
|
497
536
|
expect(values).toEqual(['#1', '#2', '#3']);
|
|
498
537
|
});
|
|
499
538
|
|
|
@@ -742,3 +781,87 @@ describe('macro: header', () => {
|
|
|
742
781
|
});
|
|
743
782
|
});
|
|
744
783
|
});
|
|
784
|
+
|
|
785
|
+
describe('mode: with site search autosuggest', () => {
|
|
786
|
+
it('renders the search with expected parameters', () => {
|
|
787
|
+
const faker = templateFaker();
|
|
788
|
+
const buttonSpy = faker.spy('autosuggest');
|
|
789
|
+
|
|
790
|
+
faker.renderComponent('header', EXAMPLE_HEADER_NAVIGATION_WITH_SITESEARCHAUTOSUGGEST);
|
|
791
|
+
|
|
792
|
+
expect(buttonSpy.occurrences[0]).toEqual({
|
|
793
|
+
ariaLimitedResults: 'Type more characters to improve your search',
|
|
794
|
+
minChars: 3,
|
|
795
|
+
language: 'en-gb',
|
|
796
|
+
ariaMinChars: 'Enter 3 or more characters for suggestions.',
|
|
797
|
+
ariaNResults: 'There are {n} suggestions available.',
|
|
798
|
+
ariaOneResult: 'There is one suggestion available.',
|
|
799
|
+
ariaResultsLabel: 'Country suggestions',
|
|
800
|
+
ariaYouHaveSelected: 'You have selected',
|
|
801
|
+
containerClasses: 'ons-autosuggest--header',
|
|
802
|
+
id: 'ons-site-search',
|
|
803
|
+
input: {
|
|
804
|
+
accessiblePlaceholder: true,
|
|
805
|
+
autocomplete: 'off',
|
|
806
|
+
classes: 'ons-input-search ons-input-search--icon',
|
|
807
|
+
label: {
|
|
808
|
+
classes: 'ons-u-pl-m ons-label--white',
|
|
809
|
+
id: 'ons-site-search-label',
|
|
810
|
+
text: 'label',
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
instructions: 'Use up and down keys to navigate.',
|
|
814
|
+
moreResults: 'Continue entering to improve suggestions',
|
|
815
|
+
noResults: 'No suggestions found.',
|
|
816
|
+
resultsTitle: 'Suggestions',
|
|
817
|
+
typeMore: 'Continue entering to get suggestions',
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
describe('when the user inputs text', () => {
|
|
822
|
+
let $; // Initialize a Cheerio instance
|
|
823
|
+
|
|
824
|
+
const mockData = [
|
|
825
|
+
{ en: 'England' },
|
|
826
|
+
{ en: 'Wales' },
|
|
827
|
+
{ en: 'Scotland' },
|
|
828
|
+
{ en: 'United States of America' },
|
|
829
|
+
{ en: 'United States Virgin Islands' },
|
|
830
|
+
{ en: 'Åland Islands' },
|
|
831
|
+
];
|
|
832
|
+
|
|
833
|
+
beforeEach(() => {
|
|
834
|
+
$ = cheerio.load(
|
|
835
|
+
renderComponent('header', {
|
|
836
|
+
...EXAMPLE_HEADER_NAVIGATION_WITH_SITESEARCHAUTOSUGGEST,
|
|
837
|
+
autosuggestData: mockData,
|
|
838
|
+
}),
|
|
839
|
+
);
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
it('does not show suggestions when input length < minimum characters', () => {
|
|
843
|
+
$('.ons-js-autosuggest-input').val('En');
|
|
844
|
+
|
|
845
|
+
setTimeout(() => {
|
|
846
|
+
const suggestionCount = $('.ons-autosuggest__option').length;
|
|
847
|
+
expect(suggestionCount).toBe(0);
|
|
848
|
+
}, 20);
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
it('shows suggestions when input length >= minimum characters', () => {
|
|
852
|
+
$('.ons-js-autosuggest-input').val('Eng');
|
|
853
|
+
|
|
854
|
+
setTimeout(() => {
|
|
855
|
+
const suggestionCount = $('.ons-autosuggest__option').length;
|
|
856
|
+
expect(suggestionCount).toBe(1);
|
|
857
|
+
}, 20);
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
it('gets the language if set', () => {
|
|
861
|
+
$('.ons-js-autosuggest-input').val('Eng');
|
|
862
|
+
|
|
863
|
+
const autosuggestElement = $('.ons-js-autosuggest').attr('data-lang');
|
|
864
|
+
expect(autosuggestElement).toBe('en-gb');
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
"fullWidth": true
|
|
3
|
+
---
|
|
4
|
+
{% from "components/header/_macro.njk" import onsHeader %}
|
|
5
|
+
|
|
6
|
+
{{
|
|
7
|
+
onsHeader({
|
|
8
|
+
"title": 'Design system',
|
|
9
|
+
"titleUrl": '#0',
|
|
10
|
+
"navigation": {
|
|
11
|
+
"id": 'main-nav',
|
|
12
|
+
"ariaLabel": 'Main menu',
|
|
13
|
+
"currentPath": '#home',
|
|
14
|
+
"itemsList": [
|
|
15
|
+
{
|
|
16
|
+
"text": 'Home',
|
|
17
|
+
"url": '#home'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"text": 'Guidance',
|
|
21
|
+
"url": '#0'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"text": 'Foundations',
|
|
25
|
+
"url": '#0'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"text": 'Components',
|
|
29
|
+
"url": '#0'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"text": 'Patterns',
|
|
33
|
+
"url": '#0'
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"toggleNavigationButton": {
|
|
37
|
+
"text": 'Menu',
|
|
38
|
+
"ariaLabel": 'Toggle main menu'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
'siteSearchAutosuggest': {
|
|
42
|
+
"autosuggestData": "/examples/data/country-of-birth.json",
|
|
43
|
+
"label": "search",
|
|
44
|
+
"instructions": "instructions",
|
|
45
|
+
"ariaYouHaveSelected": "ariaYouHaveSelected",
|
|
46
|
+
"ariaMinChars": "ariaMinChars",
|
|
47
|
+
"ariaResultsLabel": "ariaResultsLabel",
|
|
48
|
+
"ariaOneResult": "ariaOneResult",
|
|
49
|
+
"ariaNResults": "ariaNResults",
|
|
50
|
+
"ariaLimitedResults": "ariaLimitedResults",
|
|
51
|
+
"moreResults": "moreResults",
|
|
52
|
+
"resultsTitle": "resultsTitle",
|
|
53
|
+
"noResults": "noResults",
|
|
54
|
+
"typeMore": "typeMore"
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{% macro onsLabel(params) %}
|
|
2
2
|
{% if params.id %}
|
|
3
|
-
{% set descriptionID = params.id ~ "-description-hint" %}
|
|
3
|
+
{% set descriptionID = params.id ~ "-description-hint" %}
|
|
4
4
|
{% else %}
|
|
5
|
-
{% set descriptionID = "description-hint" %}
|
|
5
|
+
{% set descriptionID = "description-hint" %}
|
|
6
6
|
{% endif %}
|
|
7
7
|
|
|
8
8
|
{% if params.inputType == "checkbox" or params.inputType == "radio" %}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"instructions": params.siteSearchAutosuggest.instructions,
|
|
29
29
|
"ariaYouHaveSelected":params.siteSearchAutosuggest.ariaYouHaveSelected,
|
|
30
|
+
"minChars": params.siteSearchAutosuggest.minChars,
|
|
30
31
|
"ariaMinChars": params.siteSearchAutosuggest.ariaMinChars,
|
|
31
32
|
"ariaResultsLabel": params.siteSearchAutosuggest.ariaResultsLabel,
|
|
32
33
|
"ariaOneResult": params.siteSearchAutosuggest.ariaOneResult,
|
|
@@ -36,7 +37,8 @@
|
|
|
36
37
|
"resultsTitle": params.siteSearchAutosuggest.resultsTitle,
|
|
37
38
|
"autosuggestData": params.siteSearchAutosuggest.autosuggestData,
|
|
38
39
|
"noResults": params.siteSearchAutosuggest.noResults,
|
|
39
|
-
"typeMore": params.siteSearchAutosuggest.typeMore
|
|
40
|
+
"typeMore": params.siteSearchAutosuggest.typeMore,
|
|
41
|
+
"language": params.siteSearchAutosuggest.language
|
|
40
42
|
}) }}
|
|
41
43
|
</div>
|
|
42
44
|
{% endif %}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
{% macro onsRelatedContent(params) %}
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{% if params.classes %}
|
|
4
|
+
{% set classes = ' ' + params.classes %}
|
|
5
|
+
{% endif %}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{% from "components/related-content/_section-macro.njk" import onsRelatedContentSection %}
|
|
11
|
-
{% call onsRelatedContentSection(
|
|
12
|
-
{
|
|
13
|
-
"title": row.title,
|
|
14
|
-
"id": row.id
|
|
15
|
-
}
|
|
16
|
-
) %}
|
|
17
|
-
<nav class="ons-related-content__navigation" aria-labelledby="{{ row.id }}">
|
|
7
|
+
<aside class="ons-related-content{{ classes }}" aria-label="{{ params.ariaLabel | default("Related content") }}">
|
|
8
|
+
{% if params.rows %}
|
|
9
|
+
{% from "components/related-content/_section-macro.njk" import onsRelatedContentSection %}
|
|
18
10
|
{% from "components/list/_macro.njk" import onsList %}
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
{% for row in params.rows %}
|
|
12
|
+
{% call onsRelatedContentSection({
|
|
13
|
+
"title": row.title,
|
|
14
|
+
"id": row.id
|
|
15
|
+
}) %}
|
|
16
|
+
<nav class="ons-related-content__navigation" aria-labelledby="{{ row.id }}">
|
|
17
|
+
{{
|
|
18
|
+
onsList({
|
|
19
|
+
"variants": 'bare',
|
|
20
|
+
"iconType": row.iconType,
|
|
21
|
+
"iconPosition": row.iconPosition,
|
|
22
|
+
"iconSize": row.iconSize,
|
|
23
|
+
"itemsList": row.itemsList
|
|
24
|
+
})
|
|
25
|
+
}}
|
|
26
|
+
</nav>
|
|
27
|
+
{% endcall %}
|
|
28
|
+
{% endfor %}
|
|
29
|
+
{% else %}
|
|
30
|
+
{{ caller() if caller }}
|
|
31
|
+
{% endif %}
|
|
32
|
+
</aside>
|
|
35
33
|
|
|
36
34
|
{% endmacro %}
|
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
{% macro onsSectionNavigation(params) %}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{%
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
<nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %} {% if params.classes %} {{ params.classes }} {% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %} aria-labelledby="{{ params.hiddenTitleId | default("section-menu-nav-title")}}">
|
|
3
|
+
<h2 class="ons-u-vh" id="{{ params.hiddenTitleId | default("section-menu-nav-title") }}">{{ params.hiddenTitle | default("Pages in this section") }}</h2>
|
|
4
|
+
{% if params.sections %}
|
|
5
|
+
{% for section in params.sections %}
|
|
6
|
+
<div class="ons-section-nav__sub">
|
|
7
|
+
{% if section.title %}
|
|
8
|
+
<h3 class="ons-u-fs-r--b ons-u-mb-s">{{ section.title }}</h3>
|
|
9
|
+
{% endif %}
|
|
10
|
+
<ul class="ons-section-nav__list">
|
|
11
|
+
{% for item in section.itemsList %}
|
|
12
|
+
{% if (params.currentPath and item.url == params.currentPath) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
13
|
+
{% set isCurrent = true %}
|
|
14
|
+
{% else %}
|
|
15
|
+
{% set isCurrent = false %}
|
|
16
|
+
{% endif %}
|
|
17
|
+
<li class="ons-section-nav__item{% if item.classes %} ' ' + {{ item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
18
|
+
<a class="ons-section-nav__link" href="{{ item.url }}"{% if isCurrent == true %} aria-current="location"{% endif %}>{{ item.title }}</a>
|
|
19
|
+
{% if item.anchors and isCurrent == true %}
|
|
20
|
+
<ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
|
|
21
|
+
{% for anchor in item.anchors %}
|
|
22
|
+
<li class="ons-section-nav__item ons-list__item">
|
|
23
|
+
<a href="{{ anchor.url }}" class="ons-section-nav__link ons-list__link">{{ anchor.title }}</a>
|
|
24
|
+
</li>
|
|
25
|
+
{% endfor %}
|
|
26
|
+
</ul>
|
|
27
|
+
{% endif %}
|
|
28
|
+
</li>
|
|
29
|
+
{% endfor %}
|
|
30
|
+
</ul>
|
|
31
|
+
</div>
|
|
32
|
+
{% endfor %}
|
|
33
|
+
{% else %}
|
|
34
|
+
{% if params.title %}
|
|
35
|
+
<h3 class="ons-u-fs-r--b ons-u-mb-s">{{ params.title }}</h3>
|
|
36
|
+
{% endif %}
|
|
36
37
|
<ul class="ons-section-nav__list">
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{% endif %}
|
|
43
|
-
<li class="ons-section-nav__item{% if item.classes %} ' ' + {{ item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
44
|
-
<a class="ons-section-nav__link" href="{{ item.url }}"{% if isCurrent == true %} aria-current="location"{% endif %}>{{ item.title }}</a>
|
|
45
|
-
{% if item.anchors %}
|
|
46
|
-
<ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
|
|
47
|
-
{% for anchor in item.anchors %}
|
|
48
|
-
<li class="ons-section-nav__item ons-list__item">
|
|
49
|
-
<a href="{{ anchor.url }}" class="ons-section-nav__link ons-list__link">{{ anchor.title }}</a>
|
|
50
|
-
</li>
|
|
51
|
-
{% endfor %}
|
|
52
|
-
</ul>
|
|
38
|
+
{% for item in params.itemsList %}
|
|
39
|
+
{% if (params.currentPath and item.url == params.currentPath) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
40
|
+
{% set isCurrent = true %}
|
|
41
|
+
{% else %}
|
|
42
|
+
{% set isCurrent = false %}
|
|
53
43
|
{% endif %}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
<li class="ons-section-nav__item{% if item.classes %} ' ' + {{ item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
45
|
+
<a class="ons-section-nav__link" href="{{ item.url }}"{% if isCurrent == true %} aria-current="location"{% endif %}>{{ item.title }}</a>
|
|
46
|
+
{% if item.anchors %}
|
|
47
|
+
<ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
|
|
48
|
+
{% for anchor in item.anchors %}
|
|
49
|
+
<li class="ons-section-nav__item ons-list__item">
|
|
50
|
+
<a href="{{ anchor.url }}" class="ons-section-nav__link ons-list__link">{{ anchor.title }}</a>
|
|
51
|
+
</li>
|
|
52
|
+
{% endfor %}
|
|
53
|
+
</ul>
|
|
54
|
+
{% endif %}
|
|
55
|
+
</li>
|
|
56
|
+
{% endfor %}
|
|
57
|
+
</ul>
|
|
58
|
+
{% endif %}
|
|
59
|
+
</nav>
|
|
59
60
|
{% endmacro %}
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
{%- macro onsVideo(params) -%}
|
|
3
3
|
|
|
4
4
|
{% set linkContents %}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
{% if params.image.smallSrc %}
|
|
6
|
+
<img class="ons-video__img ons-u-mb-xs" {% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
7
|
+
{% endif %}
|
|
8
|
+
<span class="ons-video__link-text ons-u-mt-xs">{{ params.linkText }}</span>
|
|
9
9
|
{% endset %}
|
|
10
10
|
|
|
11
11
|
<div class="ons-video ons-js-video">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
{{
|
|
13
|
+
onsExternalLink({
|
|
14
|
+
"url": params.videoLinkURL,
|
|
15
|
+
"classes": "ons-video__link ons-js-video-placeholder ons-u-db",
|
|
16
|
+
"linkText": linkContents
|
|
17
|
+
})
|
|
18
|
+
}}
|
|
19
19
|
<iframe data-src="{{ params.videoEmbedUrl }}" title="{{ params.title }}" class="ons-video__iframe ons-js-video-iframe ons-u-d-no" src="about:blank" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
20
20
|
</div>
|
|
21
21
|
{%- endmacro -%}
|