Skip to content

Commit 8272175

Browse files
authored
compact version in explore panel (PR #15)
* don't show version for versionless components (identified by displayVersion current) * align versions in explore panel to right and wrap if needed * reduce line height of wrapping items * tighten space between versions
1 parent f0547da commit 8272175

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

preview-src/ui-model.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ site:
1010
versions:
1111
- &latest_version_abc
1212
url: '#'
13-
version: '1.1'
14-
displayVersion: '1.1'
15-
- url: '#'
16-
version: '1.0'
17-
displayVersion: '1.0'
13+
version: current
14+
displayVersion: current
1815
latestVersion: *latest_version_abc
1916
- &component
2017
name: xyz
@@ -36,6 +33,9 @@ site:
3633
- url: '#'
3734
version: '5.0'
3835
displayVersion: '5.0'
36+
- url: '#'
37+
version: '4.5'
38+
displayVersion: '4.5'
3939
latestVersion: *latest_version_xyz
4040
- name: '123'
4141
title: Project 123
@@ -45,12 +45,6 @@ site:
4545
url: '#'
4646
version: '2.2'
4747
displayVersion: '2.2'
48-
- url: '#'
49-
version: '2.1'
50-
displayVersion: '2.1'
51-
- url: '#'
52-
version: '2.0'
53-
displayVersion: '2.0'
5448
latestVersion: *latest_version_123
5549
page:
5650
url: *home_url

src/css/nav.css

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ html.is-clipped--nav {
213213
}
214214

215215
.nav-panel-explore .components {
216-
line-height: var(--doc-line-height);
216+
line-height: 1.3;
217217
flex-grow: 1;
218218
box-shadow: inset 0 1px 5px var(--nav-panel-divider-color);
219219
background: var(--nav-secondary-background);
@@ -229,7 +229,9 @@ html.is-clipped--nav {
229229
}
230230

231231
.nav-panel-explore .component {
232-
display: block;
232+
display: flex;
233+
justify-content: space-between;
234+
align-items: flex-start;
233235
}
234236

235237
.nav-panel-explore .component + .component {
@@ -243,20 +245,23 @@ html.is-clipped--nav {
243245
.nav-panel-explore .component .title {
244246
font-weight: var(--body-font-weight-bold);
245247
color: inherit;
248+
max-width: 50%;
249+
margin-top: 0.25rem;
250+
flex: none;
246251
}
247252

248253
.nav-panel-explore .versions {
249254
display: flex;
255+
justify-content: flex-end;
250256
flex-wrap: wrap;
251257
list-style: none;
252258
padding-left: 0;
253-
margin-top: -0.25rem;
254259
line-height: 1;
255260
}
256261

257262
.nav-panel-explore .component .version {
258263
display: block;
259-
margin: 0.375rem 0.375rem 0 0;
264+
margin: 0.25rem 0 0 0.25rem;
260265
}
261266

262267
.nav-panel-explore .component .version a {
@@ -274,9 +279,3 @@ html.is-clipped--nav {
274279
opacity: 0.9;
275280
font-weight: var(--body-font-weight-bold);
276281
}
277-
278-
/*
279-
.nav-panel-explore .component .is-latest a::after {
280-
content: " (latest)";
281-
}
282-
*/

src/partials/nav-explore.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
{{#if page.component}}
33
<div class="context">
44
<span class="title">{{page.component.title}}</span>
5-
<span class="version">{{page.componentVersion.displayVersion}}</span>
5+
<span class="version">{{#unless (eq page.componentVersion.displayVersion 'current')}}{{page.componentVersion.displayVersion}}{{/unless}}</span>
66
</div>
77
{{/if}}
88
<ul class="components">
99
{{#each site.components}}
1010
<li class="component{{#if (eq this @root.page.component)}} is-current{{/if}}">
1111
<a class="title" href="{{{relativize ./url}}}">{{{./title}}}</a>
12+
{{#if (or ./versions.[1] (not (eq ./versions.[0].displayVersion 'current')))}}
1213
<ul class="versions">
1314
{{#each ./versions}}
1415
<li class="version
@@ -18,6 +19,7 @@
1819
</li>
1920
{{/each}}
2021
</ul>
22+
{{/if}}
2123
</li>
2224
{{/each}}
2325
</ul>

0 commit comments

Comments
 (0)