Skip to content

Commit 196c293

Browse files
committed
fix: Build
1 parent 114327f commit 196c293

File tree

2 files changed

+25
-56
lines changed

2 files changed

+25
-56
lines changed

src/helpers/versionTree.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
'use strict'
22

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-
143
function splitVersions (versions) {
154
const snapshot = versions.filter((v) => v.version.includes('SNAPSHOT'))
165
const stable = versions.filter((v) => {
@@ -25,3 +14,12 @@ function splitVersions (versions) {
2514
preview: preview.length > 0 ? preview : null,
2615
}
2716
}
17+
18+
module.exports = (components) => {
19+
return Object.values(components)?.map((comp) => {
20+
return {
21+
...comp,
22+
versions: splitVersions(comp.versions),
23+
}
24+
})
25+
}

src/partials/version.hbs

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,23 @@
77
</button>
88
<div class="colset">
99
<div class="col-left">
10-
1110
<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>
5627
{{/each}}
5728
</ul>
5829
</div>

0 commit comments

Comments
 (0)