Skip to content

Commit efe5c37

Browse files
bradfrostbmuenzenmeyer
authored andcommitted
Navigation WIP
1 parent bc360f9 commit efe5c37

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
1+
<svg class="{{ className }}" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
22
<title>cheveron-down</title>
33
<path d="M9.293 12.95l0.707 0.707 5.657-5.657-1.414-1.414-4.243 4.242-4.243-4.242-1.414 1.414z"></path>
44
</svg>

packages/docs/src/_includes/components/tree-nav.njk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
<nav class="c-tree-nav">
44
<ul class="c-tree-nav">
55
{% for item in navigation.items %}
6-
<li class="c-tree-nav__item">
6+
<li class="c-tree-nav__item {% if item.subnav %}js-nav-dropdown{% endif %}">
77
{% if item.subnav %}
88
<button class="c-tree-nav__link c-tree-nav__link--btn js-nav-dropdown-trigger">
99
{{ item.label }}
10+
{% set className = "c-tree-nav__icon" %}
1011
{% include "components/icon-chevron-down.njk" %}
12+
1113
</button>
1214

1315
<ul class="c-tree-nav__subnav">

packages/docs/src/js/primary-nav.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* 4) If the nav dropdown trigger parent does not have an active class, add it.
1010
*/
1111
(function() {
12+
var navDropdownListItem = document.querySelector('.js-nav-dropdown');
1213
var navLink = document.querySelectorAll('.js-nav-dropdown-trigger'); /* 1 */
1314

1415
for (i = 0; i < navLink.length; i++) {
@@ -29,6 +30,11 @@
2930
});
3031
}
3132

33+
if (window.location.href.indexOf('docs') > -1) {
34+
console.log('yellllll');
35+
navDropdownListItem.classList.add('is-active');
36+
}
37+
3238
/**
3339
* Toggles active class on the primary nav panel
3440
* 1) Select all nav triggers and cycle through them

0 commit comments

Comments
 (0)