File tree Expand file tree Collapse file tree 2 files changed +25
-56
lines changed Expand file tree Collapse file tree 2 files changed +25
-56
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- module . exports = ( components ) => versionTree ( components )
4
-
5
- function versionTree ( components ) {
6
- return components . map ( ( comp ) => {
7
- return {
8
- ...comp ,
9
- versions : splitVersions ( comp . versions ) ,
10
- }
11
- } )
12
- }
13
-
14
3
function splitVersions ( versions ) {
15
4
const snapshot = versions . filter ( ( v ) => v . version . includes ( 'SNAPSHOT' ) )
16
5
const stable = versions . filter ( ( v ) => {
@@ -25,3 +14,12 @@ function splitVersions (versions) {
25
14
preview : preview . length > 0 ? preview : null ,
26
15
}
27
16
}
17
+
18
+ module . exports = ( components ) => {
19
+ return Object . values ( components ) ?. map ( ( comp ) => {
20
+ return {
21
+ ...comp ,
22
+ versions : splitVersions ( comp . versions ) ,
23
+ }
24
+ } )
25
+ }
Original file line number Diff line number Diff line change 7
7
</button >
8
8
<div class =" colset" >
9
9
<div class =" col-left" >
10
-
11
10
<ul class =" nav-versions" >
12
- {{ #each (versionTree site.components )}}
13
- <li class =" component" >
14
- <div >
15
- <a class =" title" href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a >
16
- </div >
17
-
18
-
19
- {{ ~#if (notEmpty ./versions.stable )}}
20
- <div class =" version-item is-active" >
21
- <div >
22
- <button class =" version-toggle" type =" button" >
23
- <span ></span >
24
- Stable
25
- </button >
26
- </div >
27
- {{> version-nav ./versions.stable }}
28
- </div >
29
- {{ /if }}
30
-
31
- {{ ~#if (notEmpty ./versions.preview )}}
32
- <div class =" version-item" >
33
- <div >
34
- <button class =" version-toggle" type =" button" >
35
- <span ></span >
36
- Preview
37
- </button >
38
- </div >
39
- {{> version-nav ./versions.preview }}
40
- </div >
41
- {{ /if }}
42
-
43
- {{ ~#if (notEmpty ./versions.snapshot )}}
44
- <div class =" version-item" >
45
- <div >
46
- <button class =" version-toggle" type =" button" >
47
- <span ></span >
48
- Snapshot
49
- </button >
50
- </div >
51
- {{> version-nav ./versions.snapshot }}
52
- </div >
53
- {{ /if }}
54
-
55
- </li >
11
+ {{ #each site.components }}
12
+ <li class =" component{{ #if (eq this @root.page.component )}} is-current{{ /if }} " >
13
+ <a class =" title" href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a >
14
+ <ul class =" versions" >
15
+ {{ #each ./versions }}
16
+ <li class =" version
17
+ {{ ~#if (and (eq .. @root.page.component ) (eq this @root.page.componentVersion ))}} is-current{{ /if ~}}
18
+ {{ ~#if (eq this ../latest )}} is-latest{{ /if }} " >
19
+ <a href =" {{{ relativize ./url }}} " >
20
+ {{ ./displayVersion }}
21
+ {{ ~#if (eq this ../latest )}} <span class =" current" >current</span >{{ /if }}
22
+ </a >
23
+ </li >
24
+ {{ /each }}
25
+ </ul >
26
+ </li >
56
27
{{ /each }}
57
28
</ul >
58
29
</div >
You can’t perform that action at this time.
0 commit comments