Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix left-nav height and padding #1661

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions assets/scss/_sidebar-tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@
// Left side navigation
//
.td-sidebar-nav {
$_max-height: calc(100vh - 8.5rem);

padding-right: 0.5rem;
margin-right: -15px;
margin-left: -15px;

@include media-breakpoint-up(md) {
@supports (position: sticky) {
max-height: calc(100vh - 10rem);
max-height: $_max-height;
overflow-y: auto;
}
}

// Adjust height and padding when sidebar_search_disable is true, but only for
// >= `lg` views, because on tablet (`md`) and mobile (<= `sm`), the search
// box is displayed regardless of the value of sidebar_search_disable:
&.td-sidebar-nav--search-disabled {
@include media-breakpoint-up(lg) {
// There's no search box so add top padding
// and adjust max-height:
padding-top: 1rem;

@supports (position: sticky) {
max-height: calc(#{$_max-height} + 4.5rem);
}
}
}

@include media-breakpoint-up(md) {
display: block !important;
}
Expand All @@ -22,7 +39,7 @@
list-style: none;
}

ul {
&.ul-0, ul {
padding: 0;
margin: 0;
}
Expand Down Expand Up @@ -119,9 +136,7 @@
}

&__search {
padding: 1rem 15px;
margin-right: -15px;
margin-left: -15px;
padding: 1rem 0;
}

&__inner {
Expand All @@ -132,7 +147,7 @@
position: sticky;
top: 4rem;
z-index: 10;
height: calc(100vh - 6rem);
height: calc(100vh - 5rem);
}
}

Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/sidebar-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
</div>
<div id="content-desktop"></div>
{{ end -}}
<nav class="collapse td-sidebar-nav{{ if .Site.Params.ui.sidebar_menu_foldable }} foldable-nav{{ end }}" id="td-section-nav">
<nav class="td-sidebar-nav collapse
{{- if .Site.Params.ui.sidebar_search_disable }} td-sidebar-nav--search-disabled{{ end -}}
{{- if .Site.Params.ui.sidebar_menu_foldable }} foldable-nav{{ end -}}
" id="td-section-nav">
{{ if (gt (len .Site.Home.Translations) 0) -}}
<div class="td-sidebar-nav__section nav-item dropdown d-block d-lg-none">
{{ partial "navbar-lang-selector.html" . }}
Expand Down