Skip to content

Commit 8523287

Browse files
committed
Make sidebar sections collapsable
1 parent 92bbafa commit 8523287

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

app/assets/stylesheets/components/sidebar.css

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,27 @@
88
margin-bottom: var(--spacing-8);
99
}
1010

11+
.sidebar-section summary.sidebar-heading {
12+
list-style: none;
13+
display: block;
14+
cursor: pointer;
15+
}
16+
17+
.sidebar-section summary.sidebar-heading::-webkit-details-marker {
18+
display: none;
19+
}
20+
21+
.sidebar-section summary.sidebar-heading::after {
22+
content: "▾";
23+
color: var(--color-text-secondary);
24+
font-size: var(--font-size-sm);
25+
margin-left: var(--spacing-2);
26+
}
27+
28+
.sidebar-section:not([open]) summary.sidebar-heading::after {
29+
content: "▸";
30+
}
31+
1132
.sidebar-content {
1233
padding: var(--spacing-3);
1334
}
@@ -36,4 +57,3 @@
3657
text-decoration: underline;
3758
}
3859
}
39-

app/views/topics/show.html.slim

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
- content_for :sidebar do
44
.sidebar
5-
.sidebar-section
6-
h3.sidebar-heading Participants
7-
- if @participants.present?
8-
.participants-list
9-
- max_participants = 12
10-
- @participants.first(max_participants).each do |participant|
11-
= render partial: "participant_row", locals: { participant: participant, avatar_size: 40 }
12-
- if @participants.size > max_participants
13-
.participant-more "+ #{(@participants.size - max_participants)} more"
14-
- else
15-
p No participants yet
5+
details.sidebar-section open=true
6+
summary.sidebar-heading Participants
7+
.sidebar-section
8+
- if @participants.present?
9+
.participants-list
10+
- max_participants = 12
11+
- @participants.first(max_participants).each do |participant|
12+
= render partial: "participant_row", locals: { participant: participant, avatar_size: 40 }
13+
- if @participants.size > max_participants
14+
.participant-more "+ #{(@participants.size - max_participants)} more"
15+
- else
16+
p No participants yet
1617

17-
.sidebar-section
18-
h3.sidebar-heading Thread Outline
18+
details.sidebar-section open=true
19+
summary.sidebar-heading Thread Outline
1920
- if @thread_outline.present?
2021
.thread-outline
2122
- @thread_outline.chunk_while { |a, b| a[:branch_segment_index] == b[:branch_segment_index] }.each do |segment|

0 commit comments

Comments
 (0)