File tree Expand file tree Collapse file tree 5 files changed +24
-22
lines changed Expand file tree Collapse file tree 5 files changed +24
-22
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 15
15
} )
16
16
}
17
17
18
- // Open first nav collapse if none are open.
19
- // Useful for pages with no nav links i.e. landing pages.
20
18
const sideNav = document . querySelector ( '#side-nav' )
21
19
if ( sideNav ) {
20
+ // Open first nav collapse if none are open.
21
+ // Useful for pages with no nav links i.e. landing pages.
22
22
const activeCollapses = sideNav . querySelectorAll ( '.collapse > .collapse-content.active' )
23
23
if ( ! activeCollapses . length ) {
24
24
const firstCollapse = sideNav . querySelector ( '.collapse > .collapse-content' )
25
25
if ( firstCollapse ) {
26
26
firstCollapse . classList . add ( 'active' )
27
27
}
28
28
}
29
+ // Auto scroll the side nav to the current page's side nav link
30
+ const currentPageLink = sideNav . querySelector ( '.nav-link.current-page' )
31
+ if ( currentPageLink ) {
32
+ currentPageLink . scrollIntoView ( { block : 'center' } )
33
+ }
29
34
}
30
35
31
36
// Top Global Nav horizontal scrolling
Original file line number Diff line number Diff line change 1
1
{{ #unless (or (eq page.layout ' landing' ) (eq page.layout ' full' ) (eq page.layout ' home' ))}}
2
- < nav class = " flex " aria-label = " breadcrumbs" >
3
- {{ #if page. breadcrumbs}}
4
- <ul class =" flex flex-wrap !list-none !m-0 !p-0" >
2
+ {{ #if page. breadcrumbs}}
3
+ < nav id = " breadcrumbs " class = " flex " aria-label = " breadcrumbs" >
4
+ <ol class =" flex flex-wrap !list-none !m-0 !p-0" >
5
5
{{ #with page.componentVersion }}
6
6
{{ #if (and ./title (ne ./title @root.page.breadcrumbs.0.content ))}}
7
- <li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" ><a href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a ></li >
7
+ <li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >
8
+ <a class =" component-home" href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a >
9
+ </li >
8
10
{{ /if }}
9
11
{{ /with }}
10
12
{{ #each page.breadcrumbs }}
11
- {{ #if (and ./url (eq ./urlType ' internal' ))}}
12
- {{ #if (is-last this ../page.breadcrumbs )}}
13
- <li class =" text-tertiary !m-0 !p-0" >{{{ ./content }}} </li >
14
- {{ else }}
13
+ {{ #if ./content }}
14
+ {{ #if (not (eq ./url @root.page.url ))}}
15
+ {{ #if (eq ./urlType ' internal' )}}
15
16
<li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >
16
17
<a href =" {{{ relativize ./url }}} " >{{{ ./content }}} </a >
17
18
</li >
19
+ {{ else }}
20
+ <li class =" text-tertiary !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >{{{ ./content }}} </li >
21
+ {{ /if }}
18
22
{{ /if }}
19
23
{{ /if }}
20
24
{{ /each }}
21
- </ul >
22
- {{ /if }}
25
+ </ol >
23
26
</nav >
27
+ {{ /if }}
24
28
{{ /unless }}
Original file line number Diff line number Diff line change 5
5
<li class =" nav-item{{ #if ./items.length }} collapse{{ /if }} " data-depth =" {{ or ../level 0 }} " >
6
6
{{ #if (and ./url (not ./items.length ))}}
7
7
<a
8
- class =" nav-link !no-underline"
8
+ class =" nav-link !no-underline{{ #if ( eq ./url @ root.page.url ) }} current-page {{ /if }} "
9
9
href =" {{ ~#if (eq ./urlType ' internal' )}} {{{ relativize ./url }}} {{ ~else }} {{{ ./url }}} {{ ~/if }} "
10
10
{{ #if (eq ./url @root.page.url )}} aria-current =" page" {{ /if }}
11
11
{{ #if (eq ./urlType ' external' )}} target =" _blank" {{ /if }} >
Original file line number Diff line number Diff line change 6
6
{{ ~/if }}
7
7
id =" side-nav"
8
8
class =" h-full bg-level1 overflow-y-scroll flex flex-col w-[18.5rem] px-2 pt-2" >
9
- <div class =" flex items-start gap-1 mb-1 " >
9
+ <div class =" flex items-start gap-1 mb-1" >
10
10
{{ #with @root.page.componentVersion }}
11
- <a class =" flex flex-grow py-1 px-2 text-h4 hover:bg-level2 rounded transition-colors !no-underline" href =" {{{ relativize ./url }}} " >{{ ./title }} </a >
11
+ <a class =" component-home flex flex-grow py-1 px-2 text-h4 hover:bg-level2 rounded transition-colors !no-underline" href =" {{{ relativize ./url }}} " >{{ ./title }} </a >
12
12
{{ /with }}
13
13
{{> page-versions page =../page }}
14
14
</div >
You can’t perform that action at this time.
0 commit comments