Skip to content

Commit c374791

Browse files
committed
revert "activate path of current page in nav using template instead of JavaScript (PR #72)"
reverts commit 37a25ca the navigation object is shared between pages, so this mutates state as pages are composed
1 parent 7e6cbe0 commit c374791

File tree

4 files changed

+3
-27
lines changed

4 files changed

+3
-27
lines changed

src/helpers/traceCurrentPath.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/js/01-nav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var currentPageItem = menuPanel.querySelector('.is-current-page')
1717
var originalPageItem = currentPageItem
1818
if (currentPageItem) {
19-
//activateCurrentPath(currentPageItem) // enable if not handled by template
19+
activateCurrentPath(currentPageItem)
2020
scrollItemToMidpoint(menuPanel, currentPageItem.querySelector('.nav-link'))
2121
} else {
2222
menuPanel.scrollTop = 0

src/partials/nav-menu.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{#with @root.page.componentVersion}}
66
<h3 class="title"><a href="{{{relativize ./url}}}">{{./title}}</a></h3>
77
{{/with}}
8-
{{> nav-tree navigation=(traceCurrentPath this)}}
8+
{{> nav-tree navigation=this}}
99
</nav>
1010
</div>
1111
{{/with}}

src/partials/nav-tree.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#if navigation.length}}
22
<ul class="nav-list">
33
{{#each navigation}}
4-
<li class="nav-item{{#with ./current}} is-current-{{{this}}} is-active{{/with}}" data-depth="{{or ../level 0}}">
4+
<li class="nav-item{{#if (eq ./url @root.page.url)}} is-current-page{{/if}}" data-depth="{{or ../level 0}}">
55
{{#if ./content}}
66
{{#if ./items.length}}
77
<button class="nav-item-toggle"></button>

0 commit comments

Comments
 (0)