diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 09f1f5aa..1cb8e824 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -175,7 +175,7 @@ h3, h4, h5, h6 { - scroll-margin-top: 1.5rem; + scroll-margin-top: 6.5rem; } /* MARK: Header @@ -364,10 +364,29 @@ nav { } .sidebar-layout { - display: flex; - flex-direction: column; - position: relative; - z-index: 2; + grid-column: 1; + position: sticky; + top: 0; + padding-top: 2rem; + background-color: white; + width: 100%; + z-index: 999; + + .sidebar { + justify-content: center; + width: 100%; + } + + .scrollbar-container { + display: none; + } + + .scrollbar-container, + .product-selector-button { + min-width: 20rem; + max-width: 50rem; + width: 100%; + } } #searchbox { @@ -420,10 +439,6 @@ nav { grid-template-rows: repeat(2, auto); column-gap: var(--grid-column-gutter); } - - .sidebar-layout { - display: none; - } } @media (min-width: 88em) { @@ -467,6 +482,17 @@ nav { .content-layout .side-gutter { grid-column-start: 2; } + + .sidebar-layout { + display: flex; + flex-direction: column; + position: relative; + z-index: 2; + + .scrollbar-container { + display: block !important; + } + } } .list-page { @@ -524,7 +550,6 @@ nav { atomic-search-interface { height: fit-content; margin-bottom: 2rem; - margin-top: 2rem; } #search-standalone-sidebar { @@ -618,6 +643,10 @@ body:not(:has(.main-layout)) header atomic-search-interface { body:has(.sidebar-layout) header atomic-search-interface { display: block; } + + body:has(.sidebar-layout) #sidebar-v2 atomic-search-interface { + display: none; + } } @media (max-width: 1023px) { @@ -1123,6 +1152,13 @@ blockquote p:last-child { grid-column: 2 !important; align-self: start; } + + .sidebar-layout { + .scrollbar-container, + .product-selector-button { + max-width: 100%; + } + } } blockquote > div > * { diff --git a/assets/js/product-selector.js b/assets/js/product-selector.js index 909b9f51..972336d4 100644 --- a/assets/js/product-selector.js +++ b/assets/js/product-selector.js @@ -1,5 +1,13 @@ document.addEventListener('DOMContentLoaded', () => { - const productSelectorContent = document.getElementById('product-selector'); + const hideSidebarBreakpoint = 88 * 16; + let productSelectorContent; + + if (window.innerWidth < hideSidebarBreakpoint) { + productSelectorContent = document.getElementById('scrollbar-container'); + } else { + productSelectorContent = document.getElementById('product-selector'); + } + const productSelectorButton = document.getElementById( 'product-selector-button' ); @@ -21,7 +29,11 @@ document.addEventListener('DOMContentLoaded', () => { window.addEventListener('click', (event) => { /* Greedy Logic to hide the product selector when something other than the button is clicked. Assumes everything has an id containing "product-selector" */ - if (!event.target.id.includes('product-selector')) { + if ( + !event.target.id.includes('product-selector') && + !event.target.id.includes('collapsible') && + !event.target.id.includes('toggle') + ) { productSelectorContent.style.display = 'none'; productSelectorButton.classList.remove('remove-bottom-radius'); } diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index ff7cf591..7dea05dc 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -1,6 +1,6 @@ document.addEventListener('DOMContentLoaded', () => { function expandToCurrentPage() { - const currentPage = document.getElementById('current-page'); + const currentPage = document.getElementById('collapsible-link-current'); if (currentPage) { let parentLabel = currentPage.closest('li'); while (parentLabel) { diff --git a/layouts/partials/sidebar-list-pages.html b/layouts/partials/sidebar-list-pages.html index 1fa864ea..2e5af8d9 100644 --- a/layouts/partials/sidebar-list-pages.html +++ b/layouts/partials/sidebar-list-pages.html @@ -1,23 +1,23 @@ {{ $currentUrl := .currentUrl }} {{ $context := .context }} -