durfdoen-2.0/layouts/partials/navbar.erb
2020-09-13 12:28:36 +02:00

36 lines
1.1 KiB
Text

<nav class="navbar">
<ul class="navbar-nav">
<li class="nav-item">
<a href="/" class="nav-link nav-link__logo">
<img src="/assets/OmdatHetDurfDoenLogoSuckt.png" alt="" class="logo__image">
</a>
</li>
<% for i in navigables %>
<li class="nav-item">
<a href="<%= i.path %>" class="nav-link">
<%= @items["/assets/navbar_icons/"+i[:naam]+".svg"].compiled_content %>
<span class="link-text"><%= i[:naam] %> </span>
</a>
</li>
<% end %>
<li class="nav-item">
<div class="nav-link">
<a href="/search.html"><%= @items["/assets/navbar_icons/search.svg"].compiled_content %></a>
<form class="link-text" action="/search.html">
<input type="search" name="q" placeholder="Zoek…">
</form>
</a>
</li>
</ul>
</nav>
<script>
const nav_links = document.querySelectorAll(".nav_link");
nav_links.forEach(nav_link => {
if (nav_link.getAttribute("href") === window.location.pathname) {
nav_link.classList.add("active_link");
}
})
</script>