privacyguides.org/_includes/nav.html
Jonah Aragon 7722f6746a
Fix navbar collapse toggle
Closes #73, Closes #63
2021-09-15 10:21:57 -05:00

42 lines
2.0 KiB
HTML

<nav class="navbar navbar-expand-lg navbar-light bg-primary">
<div class="container">
<a class="navbar-brand" href="/">
<picture>
<!--<source srcset="/assets/img/layout/privacy-guides-logo-dark.svg" media="(prefers-color-scheme: dark)">-->
<img src="/assets/img/layout/privacy-guides-logo-light.svg" alt="Privacy Guides Logo" width="300" height="39">
</picture>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<div class="ms-auto"></div>
<ul class="navbar-nav mt-2 mt-lg-0">
{% for item_hash in site.data.nav %}
{% assign item = item_hash[1] %}
{% if item.type == "link" %}
<li class="nav-item">
<a class="nav-link" href="{% link {{ item.file }} %}">{{ item.title }}</a>
</li>
{% elsif item.type == "dropdown" %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="providerDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ item.title }}
</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
{% for subitem in item.items %}
{% if subitem.type == "link" %}
<a class="dropdown-item" href="{% link {{ subitem.file }} %}{%- if subitem.anchor -%}#{{ subitem.anchor }}{%- endif -%}"><span class="{{ subitem.icon | default: "fad fa-file" }} fa-fw"></span> {{ subitem.title }}</a>
{% elsif subitem.type == "divider" %}
<div class="dropdown-divider"></div>
{% endif %}
{% endfor %}
</div>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</nav>