Skip to content

Commit 589d67a

Browse files
committed
Split the doc view
This PR adds a splitter so that the navigation panel can be resized.
1 parent 2c40a81 commit 589d67a

File tree

5 files changed

+58
-22
lines changed

5 files changed

+58
-22
lines changed

layouts/docs/baseof.html

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616
</header>
1717
<div class="container-fluid td-outer">
1818
<div class="td-main">
19-
<div class="row flex-md-nowrap">
20-
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
19+
<div class="row flex">
20+
<div id="sidebarnav" class="split td-sidebar d-print-none">
2121
{{ partial "sidebar.html" . }}
2222
</div>
23-
<main class="col-12 col-md-9 col-xl-8 pl-md-5" role="main">
24-
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
25-
{{ block "deprecated" . }}
26-
{{ partial "deprecation-warning.html" . }}
27-
{{ end }}
28-
{{ block "outdated_content" . }}
29-
{{ partial "docs/outdated_content.html" . }}
30-
{{ end }}
23+
<div id="maindoc" class="split pl-md-5 row">
24+
<!--main class="col-12 col-md-9 col-xl-8 pl-md-5" role="main"-->
25+
<main role="main" class="col-xl-8">
26+
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
27+
{{ block "deprecated" . }}
28+
{{ partial "deprecation-warning.html" . }}
29+
{{ end }}
30+
{{ block "outdated_content" . }}
31+
{{ partial "docs/outdated_content.html" . }}
32+
{{ end }}
33+
3134
{{ block "main" . }}{{ end }}
3235
{{- if .HasShortcode "thirdparty-content" -}}
3336
{{ block "thirdparty-disclaimer" . }}
@@ -39,18 +42,19 @@
3942
{{ partial "docs/auto-generated-pageinfo.html" . }}
4043
{{- end -}}
4144
{{- end -}}
42-
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
43-
{{ partial "feedback.html" .Site.Params.ui.feedback }}
44-
{{ end }}
45-
{{ partial "page-meta-lastmod.html" . }}
46-
{{ if (.Site.DisqusShortname) }}
47-
<br />
48-
{{ partial "disqus-comment.html" . }}
49-
{{ end }}
50-
</main>
51-
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
52-
{{ partial "toc.html" . }}
53-
</div>
45+
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
46+
{{ partial "feedback.html" .Site.Params.ui.feedback }}
47+
{{ end }}
48+
{{ partial "page-meta-lastmod.html" . }}
49+
{{ if (.Site.DisqusShortname) }}
50+
<br />
51+
{{ partial "disqus-comment.html" . }}
52+
{{ end }}
53+
</main>
54+
<div class="d-none d-xl-block td-toc d-print-none">
55+
{{ partial "toc.html" . }}
56+
</div>
57+
</div> <!--end of main-content-->
5458
</div>
5559
</div>
5660
</div>

layouts/partials/css.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
{{ $inServerMode := site.IsServer }}
44

5+
<!--begin splitter-->
6+
<style>
7+
.gutter {
8+
background-color: #eee;
9+
background-repeat: no-repeat;
10+
background-position: 50%;
11+
}
12+
13+
.gutter.gutter-horizontal {
14+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
15+
cursor: col-resize;
16+
}
17+
</style>
18+
<!--end splitter-->
19+
520
{{- if .Params.case_study_styles }}
621
{{ $cssOutput := "css/case-studies.css" }}
722
{{ $caseStudiesCSS := resources.Get "scss/_case-studies.scss" | resources.ToCSS }}

layouts/partials/head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
{{ end }}
8181

8282
<script src="/js/jquery-3.6.0.min.js" intregrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script>
83+
<!--script src="https://unpkg.com/split.js/dist/split.min.js"></script-->
84+
<script src="/js/split-1.6.0.js" intregrity="sha384-0blL3GqHy6+9fw0cyY2Aoiwg4onHAtslAs4OkqZY7UQBrR65/K4gI+hxLdWDrjpz"></script>
8385

8486
{{- if eq (lower .Params.cid) "community" -}}
8587
{{- if eq .Params.community_styles_migrated true -}}

layouts/partials/scripts.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@
2222
<!-- scripts for prism -->
2323
<script src='/js/prism.js'></script>
2424
{{ end }}
25+
26+
<!--for the splitter-->
27+
<script>
28+
eleNav = document.getElementById("sidebarnav");
29+
if (eleNav !== null) {
30+
Split(["#sidebarnav", "#maindoc"], {
31+
sizes: [20, 80],
32+
minSize: 100,
33+
});
34+
}
35+
</script>
36+
2537
{{ partial "hooks/body-end.html" . }}

static/js/split-1.6.0.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)