Skip to content

Commit 103e728

Browse files
Add ability to hide components which set a 'noversion' version. (quarkiverse#36)
1 parent 96c4998 commit 103e728

File tree

4 files changed

+41
-29
lines changed

4 files changed

+41
-29
lines changed

preview-src/ui-model.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ site:
1010
title: &component_title Index
1111
url: '#'
1212
versions:
13-
- &latest_version_abc
13+
- &component_version
1414
url: '#'
15-
version: 'index'
16-
displayVersion: 'index'
17-
latestVersion: *latest_version_abc
15+
version: 'noversion'
16+
displayVersion: 'noversion'
17+
latest: *component_version
1818
- name: xyz
1919
title: Project NotReally
2020
- name: xyz
@@ -25,8 +25,7 @@ site:
2525
url: /xyz/6.0/index.html
2626
version: '6.0'
2727
displayVersion: '6.0'
28-
- &component_version
29-
title: *component_title
28+
- title: *component_title
3029
url: '#'
3130
version: 'dev'
3231
displayVersion: 'dev'
@@ -36,7 +35,7 @@ site:
3635
- url: '#'
3736
version: '5.0'
3837
displayVersion: '5.0'
39-
latestVersion: *latest_version_xyz
38+
latest: *latest_version_xyz
4039
- name: '123'
4140
title: Project 123
4241
url: '#'
@@ -51,15 +50,15 @@ site:
5150
- url: '#'
5251
version: '2.0'
5352
displayVersion: '2.0'
54-
latestVersion: *latest_version_123
53+
latest: *latest_version_123
5554
page:
5655
url: *home_url
5756
home: true
5857
title: Minecraft Observability
5958
component: *component
6059
componentVersion: *component_version
61-
version: 'dev'
62-
displayVersion: 'dev'
60+
version: 'noversion'
61+
displayVersion: 'noversion'
6362
module: ROOT
6463
relativeSrcPath: index.adoc
6564
editUrl: http://example.com/project-xyz/blob/main/index.adoc

src/css/toolbar.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
}
3535
}
3636

37+
.toolbar-padder {
38+
flex-shrink: 0;
39+
}
40+
3741
.nav-toggle.is-active {
3842
background-image: url(../img/back.svg);
3943
background-size: 41.5%;

src/partials/nav-explore.hbs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
<div class="nav-panel-explore{{#unless page.navigation}} is-active{{/unless}}" data-panel="explore">
22
{{#if page.component}}
3-
<div class="context">
4-
<span class="title">{{page.component.title}}</span>
5-
<span class="version">{{page.componentVersion.displayVersion}}</span>
6-
</div>
3+
{{#if (eq "noversion" ./page.componentVersion.version )}}
4+
<!-- placeholder toolbar to align with main toolbar-->
5+
<div class="toolbar toolbar-padder" style="position: static"></div>
6+
{{ else }}
7+
<div class="context">
8+
<span class="title">{{page.component.title}}</span>
9+
<span class="version">{{page.componentVersion.displayVersion}}</span>
10+
</div>
11+
{{/if}}
712
{{/if}}
813
<ul class="components">
914
{{#each site.components}}
10-
<li class="component{{#if (eq this @root.page.component)}} is-current{{/if}}">
11-
<a class="title" href="{{{relativize ./url}}}">{{{./title}}}</a>
12-
<ul class="versions">
13-
{{#each ./versions}}
14-
<li class="version
15-
{{~#if (and (eq .. @root.page.component) (eq this @root.page.componentVersion))}} is-current{{/if~}}
16-
{{~#if (eq this ../latest)}} is-latest{{/if}}">
17-
<a href="{{{relativize ./url}}}">{{./displayVersion}}</a>
18-
</li>
19-
{{/each}}
20-
</ul>
21-
</li>
15+
{{#unless (eq "noversion" ./latest.version)}}
16+
<li class="component{{#if (eq this @root.page.component)}} is-current{{/if}}">
17+
<a class="title" href="{{{relativize ./url}}}">{{{./title}}}</a>
18+
<ul class="versions">
19+
{{#each ./versions}}
20+
<li class="version
21+
{{~#if (and (eq .. @root.page.component) (eq this @root.page.componentVersion))}} is-current{{/if~}}
22+
{{~#if (eq this ../latest)}} is-latest{{/if}}">
23+
<a href="{{{relativize ./url}}}">{{./displayVersion}}</a>
24+
</li>
25+
{{/each}}
26+
</ul>
27+
</li>
28+
{{/unless}}
2229
{{/each}}
2330
</ul>
2431
</div>

src/partials/page-versions.hbs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{{#with page.versions}}
22
<div class="page-versions">
3+
{{#unless (eq "noversion" @root.page.componentVersion.displayVersion )}}
34
<button class="version-menu-toggle" title="Show other versions of page">{{@root.page.componentVersion.displayVersion}}</button>
45
<div class="version-menu">
56
{{#each this}}
6-
<a class="version
7-
{{~#if (eq ./version @root.page.version)}} is-current{{/if~}}
8-
{{~#if ./missing}} is-missing{{/if}}" href="{{{relativize ./url}}}">{{./displayVersion}}</a>
7+
<a class="version
8+
{{~#if (eq ./version @root.page.version)}} is-current{{/if~}}
9+
{{~#if ./missing}} is-missing{{/if}}" href="{{{relativize ./url}}}">{{./displayVersion}}</a>
910
{{/each}}
1011
</div>
12+
{{/unless}}
1113
</div>
1214
{{/with}}

0 commit comments

Comments
 (0)