Skip to content

Commit 4b97af6

Browse files
author
Daniel Morse
committed
fix: Do not render bolt-nav-priority if links array is empty
1 parent 0bc98a0 commit 4b97af6

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

packages/components/bolt-nav-priority/nav-priority.twig

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
{{ validate_data_schema(bolt.data.components['@bolt-components-nav-priority'].schema, _self) | raw }}
33
{% endif %}
44

5-
<bolt-nav-priority more-text="{{ moreText | default("More"|t) }}" {{ attributes }}>
6-
<nav class="c-bolt-nav-priority">
7-
<bolt-nav-indicator
8-
{% if offset %} offset="{{ offset }}" {% endif %}
9-
>
10-
<ul class="c-bolt-nav-priority__list c-bolt-nav-priority__primary">
11-
{% for item in links %}
12-
<li class="c-bolt-nav-priority__item">
13-
{% include "@bolt-components-navlink/navlink.twig" with item only %}
14-
</li>
15-
{% endfor %}
16-
</ul>
17-
</bolt-nav-indicator>
18-
</nav>
5+
{% if links|length > 0 %}
6+
<bolt-nav-priority more-text="{{ moreText | default("More"|t) }}" {{ attributes }}>
7+
<nav class="c-bolt-nav-priority">
8+
<bolt-nav-indicator
9+
{% if offset %} offset="{{ offset }}" {% endif %}
10+
>
11+
<ul class="c-bolt-nav-priority__list c-bolt-nav-priority__primary">
12+
{% for item in links %}
13+
<li class="c-bolt-nav-priority__item">
14+
{% include "@bolt-components-navlink/navlink.twig" with item only %}
15+
</li>
16+
{% endfor %}
17+
</ul>
18+
</bolt-nav-indicator>
19+
</nav>
1920
</bolt-nav-priority>
21+
{% endif %}

0 commit comments

Comments
 (0)