Skip to content

Commit

Permalink
Merge branch 'main' into update-puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccar authored Sep 6, 2024
2 parents fc61450 + aa7b187 commit 05b152d
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 13 deletions.
69 changes: 57 additions & 12 deletions __snapshots__/layout/_template.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1393,49 +1393,60 @@ exports[`base page template matches the full configuration snapshot 1`] = `










<ul class="ons-list ons-u-mb-no ons-list--bare">





<li class="ons-list__item">






<a href="#0" class="ons-list__link">About our surveys</a>

<a href="#0" class="ons-list__link">About our surveys</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Lists of all surveys</a>

<a href="#0" class="ons-list__link">Lists of all surveys</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Respondent Charter</a>

<a href="#0" class="ons-list__link">Respondent Charter</a>
</li>
</ul>

Expand All @@ -1457,49 +1468,60 @@ exports[`base page template matches the full configuration snapshot 1`] = `










<ul class="ons-list ons-u-mb-no ons-list--bare">





<li class="ons-list__item">






<a href="#0" class="ons-list__link">What we do</a>

<a href="#0" class="ons-list__link">What we do</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Transparency and governance</a>

<a href="#0" class="ons-list__link">Transparency and governance</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Contact us</a>

<a href="#0" class="ons-list__link">Contact us</a>
</li>
</ul>

Expand All @@ -1521,13 +1543,19 @@ exports[`base page template matches the full configuration snapshot 1`] = `










<ul class="ons-list ons-u-mb-no ons-list--bare">





<li class="ons-list__item">


Expand All @@ -1549,28 +1577,32 @@ exports[`base page template matches the full configuration snapshot 1`] = `




<li class="ons-list__item">






<a href="#0" class="ons-list__link">Release calendar</a>

<a href="#0" class="ons-list__link">Release calendar</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">News</a>

<a href="#0" class="ons-list__link">News</a>
</li>
</ul>

Expand Down Expand Up @@ -1601,63 +1633,76 @@ exports[`base page template matches the full configuration snapshot 1`] = `










<ul class="ons-list ons-u-mb-s ons-footer--rows ons-list--bare ons-list--inline">





<li class="ons-list__item">






<a href="#0" class="ons-list__link">Cookies</a>

<a href="#0" class="ons-list__link">Cookies</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Accessibility statement</a>

<a href="#0" class="ons-list__link">Accessibility statement</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Privacy and data protection</a>

<a href="#0" class="ons-list__link">Privacy and data protection</a>
</li>






<li class="ons-list__item">






<a href="#0" class="ons-list__link">Terms and conditions</a>

<a href="#0" class="ons-list__link">Terms and conditions</a>
</li>
</ul>

Expand Down
12 changes: 11 additions & 1 deletion src/components/list/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@
{% else %}
{% set listEl = 'ul' %}
{% endif %}

{% if listLength < 2 %}
{% set attributes = params.itemsList[0].attributes %}
{% else %}
{% set attributes = params.attributes %}
{% endif %}
{% set openingTag = "<" + listEl %}
{% set closingTag = "</" + listEl + ">" %}

{{ openingTag | safe }}{% if params.id %}{{ ' ' }}id="{{ params.id }}"{% endif %}
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes or params.itemsList[0].attributes %}{% for attribute, value in (attributes.items() if attributes is mapping and attributes.items else attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
{%- for item in params.itemsList -%}
{% set sublistClasses = item.listClasses if item.listClasses %}
{%
Expand Down Expand Up @@ -74,6 +81,7 @@
})
}}
{%- else -%}
{# Remove setting attributes on link in future update #}
<a
href="{{ item.url }}"
class="ons-list__link{{ ' ons-js-inpagelink' if item.variants == 'inPageLink' }}{{ ' ' + item.classes if item.classes else '' }}"
Expand Down Expand Up @@ -115,9 +123,11 @@
{% endset %}

{% if listLength > 1 or listEl == 'ul' %}
{# Remove if not item.url in future update #}
<li
class="ons-list__item{{ ' ' + item.listClasses if item.listClasses else '' }}"
{% if item.current %}aria-current="true"{% endif %}
{% if not item.url %}{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}{% endif %}
>
{{- listItem | safe -}}
</li>
Expand Down

0 comments on commit 05b152d

Please sign in to comment.