Skip to content

Commit 9575a2a

Browse files
committed
Update left nav splitter for Docsy 0.7
1 parent 65bd17e commit 9575a2a

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

assets/scss/_custom.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,11 @@ body.td-search {
19721972
color: #ffffff !important;
19731973
}
19741974

1975+
// Avoid having padding left of sidebar
1976+
body .container-fluid.td-outer:has(> .td-main #nav-sidebar) {
1977+
padding-left: 0;
1978+
}
1979+
19751980
body.td-home section.case-studies {
19761981
h2, h3 {
19771982
text-align: center;

assets/scss/_k8s_sidebar-tree.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,28 @@
1313
background-color: #eee;
1414
background-repeat: no-repeat;
1515
background-position: 50%;
16+
flex-grow: 0;
17+
padding: 0;
18+
}
1619

1720
&.gutter-horizontal {
1821
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
1922
cursor: col-resize;
23+
}
24+
25+
#sidebarnav,
26+
#maindoc {
27+
max-width: 100%;
28+
}
29+
30+
#maindoc {
31+
overflow-wrap: break-word;
32+
}
33+
34+
@media (max-width: 768px) {
35+
#sidebarnav {
36+
padding-left: 2.25rem;
37+
padding-right: 2.25rem;
2038
}
2139
}
2240

hugo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ url = "https://v1-30.docs.kubernetes.io"
213213

214214
# User interface configuration
215215
[params.ui]
216+
# Allow resizing the sidebar gutter
217+
sidebar_resizable = true
216218
# Enable to show the side bar menu in its compact state.
217219
sidebar_menu_compact = false
218220
# Show this many levels in compact mode

layouts/docs/baseof.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</header>
1515
<div class="container-fluid td-outer">
1616
<div class="td-main">
17-
<div class="row flex-column flex-md-row">
18-
<div id="sidebarnav" class="split td-sidebar d-print-none">
17+
<div class="row flex-xl-nowrap">
18+
<div id="nav-sidebar" class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none{{ if .Site.Params.ui.sidebar_resizable }} split{{ end }}">
1919
{{ partial "sidebar.html" . }}
2020
</div>
2121
<div id="maindoc" class="split pl-md-5 row">

layouts/partials/hooks/body-end.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
function enableSplitter(mediaQuery) {
1111
if (mediaQuery.matches) {
1212
if (!splitInstance) {
13-
splitInstance = Split(["#sidebarnav", "#maindoc"], {
13+
splitInstance = Split(["#nav-sidebar", ".docs-main-content"], {
1414
sizes: [20, 80],
1515
minSize: 100,
16+
gutterSize: 8 // pixels
1617
});
1718
}
1819
} else {
@@ -25,7 +26,7 @@
2526

2627
const screenWidthMediaQuery = window.matchMedia("(min-width: 768px)");
2728

28-
const eleNav = document.getElementById("sidebarnav");
29+
const eleNav = document.getElementById("nav-sidebar");
2930
if (eleNav !== null) {
3031
enableSplitter(screenWidthMediaQuery);
3132
screenWidthMediaQuery.addListener(enableSplitter);

0 commit comments

Comments
 (0)