-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathsidebar-section.twig
More file actions
26 lines (26 loc) · 1.26 KB
/
sidebar-section.twig
File metadata and controls
26 lines (26 loc) · 1.26 KB
1
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
{% set is_leaf = node.children is not defined or node.children is empty %}
<section class="docs-sidebar__section{{ nested ? ' docs-sidebar__section--nested' : ' docs-sidebar__section--root' }}{{ is_leaf ? ' docs-sidebar__section--leaf' : '' }}" data-id="{{ node._id }}">
<a class="docs-sidebar__section-title-wrapper"
href="{{ node.uri ? '/' ~ node.uri : '/page/' ~ node._id }}"
>
<div class="docs-sidebar__section-title{% if not nested %} docs-sidebar__section-title--root{% endif %}{% if page is defined and toString(page._id) == toString(node._id) %} docs-sidebar__section-title--active{% endif %}">
<span>
{{ node.title | striptags }}
</span>
{% if node.children is defined and node.children is not empty %}
<button type="button" class="docs-sidebar__section-toggler" aria-label="Toggle section">
{{ svg('arrow-up') }}
</button>
{% endif %}
</div>
</a>
{% if node.children is defined and node.children is not empty %}
<ul class="docs-sidebar__section-list docs-sidebar__section-list--nested">
{% for child in node.children %}
<li>
{% include 'components/sidebar-section.twig' with { node: child, nested: true } %}
</li>
{% endfor %}
</ul>
{% endif %}
</section>