catbase/bot/nav.templ

25 lines
1.1 KiB
Plaintext

package bot
templ (b *bot) Nav(currentPage string, items []EndPoint) {
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="/">catbase</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
for _, item := range items {
<li class="nav-item">
if currentPage == item.Name {
<a class="nav-link active" aria-current="page" href={ templ.URL(item.URL) }>{ item.Name }</a>
} else {
<a class="nav-link" href={ templ.URL(item.URL) }>{ item.Name }</a>
}
</li>
}
</ul>
</div>
</div>
</nav>
}