Skip to content

Commit 3179e88

Browse files
authored
REVERT: reverting toggle to do display issues (#72)
1 parent fc53d7e commit 3179e88

File tree

8 files changed

+91
-299
lines changed

8 files changed

+91
-299
lines changed

assets/sprite.svg

Lines changed: 4 additions & 11 deletions
Loading

common/common.scss

Lines changed: 56 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
11
$padding-basis: 0.75em;
22

3-
.d-toc-available {
4-
// the toc increases the timeline container's width
5-
// so as long as the toc is available in a topic
6-
// we want this width to remain for the timeline
7-
// so if the toc is toggled off, the position doesn't shift
8-
9-
@media screen and (max-width: 1109px) {
10-
.d-toc-wrapper {
11-
width: 10em;
12-
}
13-
}
14-
15-
@media screen and (min-width: 1110px) {
16-
.container.posts {
17-
grid-template-columns: auto 14.6em;
18-
}
19-
}
20-
}
21-
223
.d-toc-main {
234
display: none;
5+
width: 225px;
6+
@media screen and (max-width: 1045px) {
7+
.desktop-view & {
8+
width: 150px;
9+
}
10+
}
2411
border-left: 1px solid var(--primary-low);
2512
box-sizing: border-box;
2613
a {
2714
display: block;
2815
padding: 0.15em 0;
29-
color: var(--primary-700);
16+
color: var(--primary-medium);
3017
&.scroll-to-bottom {
31-
color: var(--tertiary);
3218
padding-left: $padding-basis;
33-
margin-top: 0.5em;
34-
font-size: var(--font-down-1);
3519
}
3620
}
3721
#d-toc {
38-
max-height: calc(100dvh - 7em - var(--header-offset));
22+
max-height: calc(100vh - 4.5em - var(--header-offset));
23+
padding-bottom: 0.5em;
3924
overflow: auto;
4025
ul {
4126
list-style-type: none;
@@ -62,7 +47,7 @@ $padding-basis: 0.75em;
6247
}
6348
}
6449
> a:hover {
65-
color: var(--primary);
50+
color: var(--primary-high);
6651
}
6752
&.direct-active > a {
6853
position: relative;
@@ -139,147 +124,62 @@ a.d-toc-close {
139124
display: none;
140125
}
141126

142-
.d-toc-timeline-toggle {
143-
display: none;
144-
position: fixed;
145-
bottom: 0;
146-
@include ellipsis;
147-
.d-icon-timeline {
148-
margin-right: 0.25em;
149-
}
150-
151-
@media screen and (min-height: 1200px) {
152-
// on tall screens we don't want this button
153-
// to be incredibly distant
154-
position: absolute;
155-
.d-toc-timeline-visible & {
156-
bottom: -4em;
157-
}
158-
bottom: -6.5em;
159-
}
160-
}
161-
162-
.topic-navigation.with-timeline:has(.timeline-docked) {
163-
// hide toggle when timeline is docked
164-
// (firefox doesn't support :has yet)
165-
.d-toc-timeline-toggle {
166-
display: none;
167-
}
168-
}
169-
170-
.d-toc-timeline-toggleable {
171-
.d-toc-timeline-toggle {
172-
display: block;
173-
z-index: z("timeline");
174-
@media screen and (max-height: 480px) {
175-
// avoid overlapping timeline
176-
display: none;
177-
}
178-
}
179-
.with-topic-progress {
180-
.d-toc-main {
181-
display: block;
182-
}
183-
.d-toc-timeline-toggle {
184-
display: none;
185-
}
186-
}
187-
}
188-
189127
.d-toc-timeline-visible {
190128
.d-toc-main,
191129
.d-toc-mini {
192130
display: block;
193131
}
194-
195-
// core overrides when timeline is active
196-
.timeline-container {
197-
display: none;
198-
}
199-
.container.posts .topic-navigation.with-topic-progress {
200-
align-self: start;
201-
}
202-
}
203-
204-
// overlayed timeline (on mobile and narrow screens)
205-
.topic-navigation.with-topic-progress {
206-
.d-toc-timeline-toggle {
207-
display: none;
208-
}
209-
.d-toc-wrapper {
210-
position: fixed;
211-
margin-top: 0.25em;
212-
height: calc(100dvh - 50px - var(--header-offset));
213-
opacity: 0.5;
214-
right: -100vw;
215-
top: var(--header-offset);
216-
width: 75vw;
217-
max-width: 350px;
218-
background-color: var(--secondary);
219-
box-shadow: var(--shadow-dropdown);
220-
z-index: z("modal", "overlay");
221-
transition: all 0.2s ease-in-out;
222-
.d-toc-main {
223-
width: 100%;
224-
padding: 0.5em;
225-
height: 100%;
226-
#d-toc {
227-
max-height: calc(100% - 2.25em);
228-
}
229-
}
230-
&.overlay {
231-
right: 0;
132+
// overlayed timeline (on mobile and narrow screens)
133+
.topic-navigation.with-topic-progress {
134+
.d-toc-wrapper {
135+
position: fixed;
136+
margin-top: 0.25em;
137+
height: calc(100vh - 50px - var(--header-offset));
138+
opacity: 0.5;
139+
right: -100vw;
140+
top: var(--header-offset);
232141
width: 75vw;
233-
opacity: 1;
142+
max-width: 350px;
143+
background-color: var(--secondary);
144+
box-shadow: var(--shadow-dropdown);
145+
z-index: z("modal", "overlay");
146+
transition: all 0.2s ease-in-out;
234147
.d-toc-main {
235-
display: block;
236-
#d-toc li.d-toc-item ul {
148+
width: 100%;
149+
padding: 0.5em;
150+
height: 100%;
151+
#d-toc {
152+
max-height: calc(100% - 3em);
153+
}
154+
}
155+
&.overlay {
156+
right: 0;
157+
width: 75vw;
158+
opacity: 1;
159+
.d-toc-main #d-toc li.d-toc-item ul {
237160
transition: none;
238161
}
239162
}
240-
}
241163

242-
a.scroll-to-bottom {
243-
margin-top: 0.33em;
244-
}
245-
246-
a.scroll-to-bottom,
247-
a.d-toc-close {
248-
display: inline-block;
249-
padding: 0.5em;
250-
}
164+
a.scroll-to-bottom,
165+
a.d-toc-close {
166+
display: inline-block;
167+
padding: 0.5em;
168+
}
251169

252-
.d-toc-icons {
253-
position: absolute;
254-
background: var(--secondary);
255-
right: 1.5em;
256-
top: 0.25em;
257-
z-index: z("timeline");
170+
.d-toc-icons {
171+
text-align: right;
172+
}
258173
}
259174
}
260-
}
261175

262-
#topic-progress-wrapper {
263-
align-items: stretch;
264-
.d-toc-mini {
176+
// core overrides when timeline is active
177+
.timeline-container,
178+
#topic-progress {
265179
display: none;
266-
267-
height: 100%;
268-
.btn {
269-
height: 100%;
270-
}
271180
}
272-
273-
.staff & {
274-
.topic-admin-menu-button-container {
275-
margin-left: 0.5em;
276-
}
277-
}
278-
}
279-
280-
.d-toc-timeline-toggleable {
281-
#topic-progress-wrapper .d-toc-mini {
282-
display: block;
181+
.container.posts .topic-navigation.with-topic-progress {
182+
align-self: start;
283183
}
284184
}
285185

@@ -332,5 +232,11 @@ a.d-toc-close {
332232
.below-docs-topic-outlet.d-toc-wrapper {
333233
position: sticky;
334234
top: calc(var(--header-offset, 60px) + 1em);
335-
max-height: calc(100dvh - 2em - var(--header-offset, 60px));
235+
max-height: calc(100vh - 2em - var(--header-offset, 60px));
236+
.mobile-view & {
237+
display: none;
238+
}
239+
.d-toc-main {
240+
display: block;
241+
}
336242
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="d-toc-mini">
2+
<DButton
3+
class="btn-primary"
4+
@action={{this.showTOCOverlay}}
5+
@label={{theme-prefix "table_of_contents"}}
6+
/>
7+
</div>

javascripts/discourse/connectors/before-topic-progress/d-toc-mini.js renamed to javascripts/discourse/connectors/after-topic-progress/d-toc-mini.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,4 @@ export default class DTocMini extends Component {
66
showTOCOverlay() {
77
document.querySelector(".d-toc-wrapper").classList.toggle("overlay");
88
}
9-
10-
@action
11-
resetBodyClass() {
12-
document.body.classList.add("d-toc-timeline-visible");
13-
}
149
}

javascripts/discourse/connectors/before-topic-progress/d-toc-mini.hbs

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)