Skip to content

Commit 4631367

Browse files
committed
TEST: move the table of contents into the <div>
This looks a bit more pleasant to me, personally.
1 parent a1408ca commit 4631367

File tree

3 files changed

+59
-34
lines changed

3 files changed

+59
-34
lines changed

assets/sass/reference.scss

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,6 @@ h3.plumbing {
111111
&#reference-languages-trigger {
112112
float: right;
113113
}
114-
115-
// Ensure the TOC trigger floats right like topics/languages
116-
&#reference-toc-trigger {
117-
float: right;
118-
}
119-
}
120-
121-
// Place the "last updated" span inline next to the left-floating versions trigger
122-
> span.light {
123-
display: inline-block;
124-
clear: none;
125-
margin-left: 6px;
126-
vertical-align: middle;
127114
}
128115
}
129116

@@ -226,25 +213,65 @@ h3.plumbing {
226213
}
227214
}
228215

229-
// Position the Table of Contents dropdown under the right-floated TOC trigger
230-
#toc-dropdown {
231-
width: 300px;
232-
right: 12px;
233-
padding: 12px;
234-
font-weight: normal;
235-
line-height: 1;
216+
// New inline TOC box styles
217+
.toc-box {
218+
float: right;
219+
width: 200px;
220+
margin: 0 0 15px 20px;
221+
padding: 10px 12px;
222+
font-size: 13px;
223+
background-color: var(--callout-color);
224+
border: 1px solid var(--base-border-color);
225+
@include border-radius(3px);
236226

237-
ul {
227+
.toc-box-header {
228+
font-weight: bold;
229+
margin-bottom: 8px;
230+
}
231+
232+
.toc-list {
238233
margin: 0;
234+
padding-left: 18px;
235+
list-style: disc;
239236
}
240237

241-
li {
238+
.toc-list li {
239+
margin: 2px 0;
242240
line-height: $base-line-height * 0.8;
243241
}
244242

245-
a {
243+
.toc-list a {
246244
font-weight: normal;
247-
padding: 0;
245+
}
246+
}
247+
248+
// Ensure content can flow around the TOC naturally
249+
#documentation #main {
250+
.sectionbody {
251+
overflow: visible;
252+
}
253+
254+
.verseblock {
255+
overflow: visible;
256+
257+
.content {
258+
overflow: visible;
259+
260+
pre {
261+
overflow: visible;
262+
white-space: pre-wrap;
263+
}
264+
}
265+
}
266+
}
267+
268+
// Stack TOC box full-width on small screens
269+
@media (max-width: $mobile-m) {
270+
.toc-box {
271+
float: none;
272+
width: 80%;
273+
max-width: none;
274+
margin-right: 0;
248275
}
249276
}
250277

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ <h1>{{ .Params.book.section.cs_number }} {{ .Params.book.chapter.title }} - {{ .
123123
<div id='reference-version'>
124124
{{ partial "ref/languages.html" . }}
125125
{{ partial "ref/topics.html" . }}
126-
{{ partial "ref/toc.html" . }}
127126
{{ partial "ref/versions.html" . }}
128127
</div>
129128

@@ -136,6 +135,7 @@ <h2>This information is specific to the Git project</h2>
136135
<p>Please note that this information is only relevant to you if you plan on <a href="{{ relURL "community#contributing" }}">contributing to the Git project itself</a>. It is in no shape or form required reading for regular Git users.</p>
137136
</div>
138137
{{ end }}
138+
{{ partial "ref/toc.html" . }}
139139
{{ .Content }}
140140
{{ $match := findRESubmatch "(?s)>NAME</h2>.*?<p[^>]*>(git-)?([^ ]+)" .Content 1 }}
141141
{{ if (eq ($match | len) 1) }}

layouts/partials/ref/toc.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{{ $headings := .Params.headings }}
22
{{ if $headings }}
3-
<a class="dropdown-trigger" id="reference-toc-trigger" data-panel-id="toc-dropdown" href="#">Table of Contents ▾</a>
4-
<div class='dropdown-panel right' id='toc-dropdown'>
5-
<div>
6-
<ul class="toc">
7-
{{ range $i, $item := $headings }}
8-
<li><a href="#{{ .id }}">{{ .text }}</a></li>
9-
{{ end }}
10-
</ul>
11-
</div>
3+
<div id='toc-box' class='toc-box'>
4+
<div class='toc-box-header'>Table of Contents</div>
5+
<ul class="toc-list">
6+
{{ range $i, $item := $headings }}
7+
<li><a href="#{{ .id }}">{{ .text }}</a></li>
8+
{{ end }}
9+
</ul>
1210
</div>
1311
{{ end }}

0 commit comments

Comments
 (0)