Skip to content

Commit 4d5f640

Browse files
committed
Hide other versions inside an accordion to reduce noise in the sidebar.
1 parent 4a6ff8d commit 4d5f640

File tree

3 files changed

+51
-40
lines changed

3 files changed

+51
-40
lines changed

lib/ffdocs/view/styles/_colors.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ nav {
7676
color: var(--nav-fg);
7777
border-right: 2px solid var(--main-green);
7878

79-
& > a {
79+
.other-versions a {
8080
font-family: monospace;
8181

8282
color: var(--main-green);
@@ -89,6 +89,11 @@ nav {
8989
}
9090
}
9191

92+
.version-label, .other-versions {
93+
color: #fff;
94+
background: rgba(0, 0, 0, 0.8);
95+
}
96+
9297
.current-version {
9398
background: var(--nav-current-version-bg);
9499
color: var(--nav-current-version-fg);

lib/ffdocs/view/styles/_layout.scss

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,12 @@ nav {
7575
padding: 1ex;
7676
}
7777

78-
.current-version {
79-
& > .version-label {
80-
background: rgba(0, 0, 0, 0.8);
81-
}
78+
.other-versions summary {
79+
padding-left: 1ex;
80+
}
8281

82+
.current-version {
8383
details {
84-
summary {
85-
display: block; // Remove icon.
86-
cursor: pointer;
87-
outline: 0;
88-
89-
padding: 0.5rem 0.5rem 0.5rem 1rem;
90-
border-bottom: 1px solid $nav-summary-border-color;
91-
92-
&::after {
93-
content: " ";
94-
95-
float: right;
96-
display: inline-block;
97-
98-
margin-left: 1ch;
99-
height: 1em;
100-
width: 1em;
101-
102-
background-image: svg-file(arrow);
103-
background-size: 1em;
104-
background-position: center right;
105-
background-repeat: no-repeat;
106-
107-
transition: transform 200ms ease-in;
108-
}
109-
}
110-
11184
a, b {
11285
&:not(.hidden) {
11386
display: block;
@@ -147,11 +120,6 @@ nav {
147120
}
148121
}
149122

150-
details[open] > summary::after {
151-
// Flip icon in <summary> when <details> is open.
152-
transform: scale(1, -1);
153-
}
154-
155123
& > details {
156124
clear: both;
157125

@@ -177,6 +145,41 @@ nav {
177145
.hidden {
178146
display: none;
179147
}
148+
149+
details {
150+
summary {
151+
display: block; // Remove icon.
152+
cursor: pointer;
153+
outline: 0;
154+
155+
padding: 0.5rem 0.5rem 0.5rem 1rem;
156+
border-bottom: 1px solid $nav-summary-border-color;
157+
158+
&::after {
159+
content: " ";
160+
161+
float: right;
162+
display: inline-block;
163+
164+
margin-left: 1ch;
165+
height: 1em;
166+
width: 1em;
167+
168+
background-image: svg-file(arrow);
169+
background-size: 1em;
170+
background-position: center right;
171+
background-repeat: no-repeat;
172+
173+
transition: transform 200ms ease-in;
174+
}
175+
}
176+
177+
&[open] > summary::after {
178+
// Flip icon in <summary> when <details> is open.
179+
transform: scale(1, -1);
180+
}
181+
}
182+
180183
}
181184

182185
main {

lib/ffdocs/view/templates/_layout.haml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@
5757
%label.show-all-label{for: show_all_id} Show All
5858
%input.show-all{id: show_all_id, type: "checkbox"}
5959

60-
- releases.each do |it_release|
61-
- if release != it_release
62-
!= link_to_file versioned_target(it_release, item), it_release.version, class: "version"
60+
- if releases.size > 1
61+
%details.other-versions
62+
%summary Other
63+
- releases.each do |it_release|
64+
- if release != it_release
65+
!= link_to_file versioned_target(it_release, item), it_release.version, class: "version"
6366

6467
%main{class: main_class}
6568
!= main_body

0 commit comments

Comments
 (0)