-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split navbar, remove links from bottom to top
- Loading branch information
1 parent
ca6f454
commit fbae837
Showing
3 changed files
with
67 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<nav class="navbar" role="navigation" aria-label="main navigation"> | ||
<div class="navbar-brand"> | ||
<a class="icon-text navbar-item" href="/"> | ||
<span class="icon"><img alt="logo" src="/public/logo.png"/></span> | ||
<span class="has-text-weight-bold">{{.SITENAME}}</span> | ||
</a> | ||
|
||
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarMenu"> | ||
<span aria-hidden="true"></span> | ||
<span aria-hidden="true"></span> | ||
<span aria-hidden="true"></span> | ||
<span aria-hidden="true"></span> | ||
</a> | ||
</div> | ||
|
||
<div id="navbarMenu" class="navbar-menu"> | ||
<div class="navbar-start"> | ||
{{- if .page }} | ||
{{- range $i, $a := links .page -}} | ||
<a href="{{.Link}}" class="navbar-item"> | ||
<span>{{.Name}}</span> | ||
</a> | ||
{{- end -}} | ||
{{- end }} | ||
</div> | ||
|
||
<div class="navbar-end"> | ||
<div class="navbar-item"> | ||
|
||
{{- if .page -}} | ||
{{- with widgets "search" .page -}} | ||
{{ . }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
<div class="columns pt-5"> | ||
<div class="column"> | ||
<a class="icon-text title is-5 pt-2" href="/"> | ||
<span class="icon"><img alt="logo" src="/public/logo.png"/></span> | ||
<span>{{.SITENAME}}</span> | ||
</a> | ||
</div> | ||
|
||
{{- if .page -}} | ||
{{- with widgets "search" .page -}} | ||
<div class="column is-4"> {{ . }} </div> | ||
{{- end -}} | ||
{{- end -}} | ||
</div> | ||
|
||
{{- if ne .INDEX .page.Name -}} | ||
<div dir="auto" class="title is-1 has-text-weight-bold">{{ .title }}</div> | ||
{{- end -}} | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
|
||
// Get all "navbar-burger" elements | ||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); | ||
|
||
// Add a click event on each of them | ||
$navbarBurgers.forEach( el => { | ||
el.addEventListener('click', () => { | ||
|
||
// Get the target from the "data-target" attribute | ||
const target = el.dataset.target; | ||
const $target = document.getElementById(target); | ||
|
||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" | ||
el.classList.toggle('is-active'); | ||
$target.classList.toggle('is-active'); | ||
|
||
}); | ||
}); | ||
|
||
}); | ||
</script> |