diff --git a/assets/scss/components/_sidebar.scss b/assets/scss/components/_sidebar.scss index 0faad40c..2f4b1b72 100644 --- a/assets/scss/components/_sidebar.scss +++ b/assets/scss/components/_sidebar.scss @@ -7,22 +7,45 @@ top: var(--navbar-offset); max-height: 90vh; overflow-y: auto; + scrollbar-gutter: stable; } .sidebar-item { color: rgba(0, 0, 0, 0.65); margin-left: 0 !important; - padding-left: 0.85rem !important; display: inline-block; + padding: 0.1875rem 0.5rem !important; + + &.active { + color: $primary; + } - &.active, &:hover, &:focus { - color: black; + color: $primary; + background-color: tint-color($primary, 90%); } } -.btn-toggle { +.sidebar-item-group { + &:hover, + &:focus { + color: $primary; + background-color: tint-color($primary, 90%); + } + + > div > a { + color: var(--bs-body-color) !important; + text-decoration: none; + cursor: pointer; + } +} + +.sidebar-item-group > div { + padding: 0.1875rem 0.5rem !important; +} + +.btn-toggle-group { padding: 0.25rem 0.5rem; font-weight: 600; color: rgba(0, 0, 0, 0.65); @@ -30,8 +53,7 @@ &:hover, &:focus { - color: black; - background-color: tint-color($primary, 90%); + background-color: transparent; } &::before { @@ -43,50 +65,49 @@ } } -.btn-toggle[aria-expanded="true"] { - color: black; - +.btn-toggle-group[aria-expanded="true"] { &::before { transform: rotate(90deg); } } -.btn-toggle-nav a { - padding: 0.1875rem 0.5rem; - margin-top: 0.125rem; - margin-left: 1.25rem; - - &:hover, - &:focus { - background-color: tint-color($primary, 90%); - } - - &.active { - font-weight: bold; - } -} - @if $enable-dark-mode { @include color-mode(dark) { .sidebar-item { color: var(--bs-body-color); - margin-left: 0 !important; - padding-left: 0.85rem !important; - - &.active, + + &.active { + color: $primary-text-emphasis-dark !important; + } + + &:hover, + &:focus { + color: $primary-text-emphasis-dark !important; + background-color: transparent; + box-shadow: inset 0 0 0 1px $primary-bg-subtle-dark; + } + } + + .sidebar-item-group { + color: var(--bs-body-color) !important; + + &.active { + color: $primary-text-emphasis-dark !important; + } + &:hover, &:focus { color: white !important; background-color: transparent; + box-shadow: inset 0 0 0 1px $primary-bg-subtle-dark; } } - .btn-toggle { + .btn-toggle-group { color: var(--bs-body-color); &:hover, &:focus { - color: white !important; background-color: transparent; } @@ -95,26 +116,10 @@ } } - .btn-toggle[aria-expanded="true"] { + .btn-toggle-group[aria-expanded="true"] { color: var(--bs-secondary-color); } - - .btn-toggle-nav a { - padding: 0.1875rem 0.5rem; - margin-top: 0.125rem; - margin-left: 1.25rem; - - &:hover, - &:focus { - color: white !important; - background-color: transparent; - } - - &.active { - font-weight: bold; - } - } - } + } } // scss-docs-end sidebar diff --git a/layouts/partials/assets/sidebar.html b/layouts/partials/assets/sidebar.html index 5c5dfd7e..d4b1e217 100644 --- a/layouts/partials/assets/sidebar.html +++ b/layouts/partials/assets/sidebar.html @@ -28,12 +28,34 @@ {{- $doc_slug := partial "utilities/URLJoin.html" (dict "base" $baseURL "path" ($group.title | urlize)) -}} {{- $href := or $group.link $doc_slug -}} + {{ $ref := partial "utilities/GetPage.html" (dict "url" $href "page" $page) }} + {{ if eq $group.link "#" }}{{ $href = $doc_slug }}{{ end }} {{- $collapsed := strings.HasPrefix $page.RelPermalink $href -}} + {{ if not (hasSuffix $href "/") }}{{ $href = printf "%s/" $href }}{{ end }} + {{- $current := eq $href $page.RelPermalink }}
  • - +