Skip to content

Commit 14455aa

Browse files
committed
Fix left-nav height and padding (no vars)
1 parent d30b1c9 commit 14455aa

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

assets/scss/_sidebar-tree.scss

+26-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,39 @@
22
// Left side navigation
33
//
44
.td-sidebar-nav {
5+
$_max-height: calc(100vh - 8.5rem);
6+
57
padding-right: 0.5rem;
68
margin-right: -15px;
79
margin-left: -15px;
810

911
@include media-breakpoint-up(md) {
1012
@supports (position: sticky) {
11-
max-height: calc(100vh - 10rem);
13+
max-height: $_max-height;
1214
overflow-y: auto;
1315
}
1416
}
1517

18+
// Adjust height and padding when sidebar_search_disable is true
19+
&.td-sidebar-nav--search-disabled {
20+
padding-top: 1rem;
21+
22+
@include media-breakpoint-up(md) {
23+
@supports (position: sticky) {
24+
max-height: calc(#{$_max-height} + 4.5rem);
25+
}
26+
}
27+
}
28+
29+
// Handle the case where #content-mobile is displayed with a search box,
30+
// regardless of the value of sidebar_search_disable:
31+
@include media-breakpoint-only(md) {
32+
padding-top: 0 !important;
33+
@supports (position: sticky) {
34+
max-height: $_max-height !important;
35+
}
36+
}
37+
1638
@include media-breakpoint-up(md) {
1739
display: block !important;
1840
}
@@ -22,7 +44,7 @@
2244
list-style: none;
2345
}
2446

25-
ul {
47+
&.ul-0, ul {
2648
padding: 0;
2749
margin: 0;
2850
}
@@ -119,9 +141,7 @@
119141
}
120142

121143
&__search {
122-
padding: 1rem 15px;
123-
margin-right: -15px;
124-
margin-left: -15px;
144+
padding: 1rem 0;
125145
}
126146

127147
&__inner {
@@ -132,7 +152,7 @@
132152
position: sticky;
133153
top: 4rem;
134154
z-index: 10;
135-
height: calc(100vh - 6rem);
155+
height: calc(100vh - 5rem);
136156
}
137157
}
138158

layouts/partials/sidebar-tree.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
</div>
1919
<div id="content-desktop"></div>
2020
{{ end -}}
21-
<nav class="collapse td-sidebar-nav{{ if .Site.Params.ui.sidebar_menu_foldable }} foldable-nav{{ end }}" id="td-section-nav">
21+
<nav class="td-sidebar-nav collapse
22+
{{- if .Site.Params.ui.sidebar_search_disable }} td-sidebar-nav--search-disabled{{ end -}}
23+
{{- if .Site.Params.ui.sidebar_menu_foldable }} foldable-nav{{ end -}}
24+
" id="td-section-nav">
2225
{{ if (gt (len .Site.Home.Translations) 0) -}}
2326
<div class="td-sidebar-nav__section nav-item dropdown d-block d-lg-none">
2427
{{ partial "navbar-lang-selector.html" . }}

0 commit comments

Comments
 (0)