From 2fbce3474833a78d51144fb5f0181ced2f6bdf28 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Fri, 26 Aug 2022 23:50:16 +0200 Subject: [PATCH 1/3] ENH: Add section title to sidebar navigation --- .../styles/components/_navbar-links.scss | 5 +++ .../styles/sections/_sidebar-primary.scss | 10 ++++- .../components/navbar-nav.html | 11 +++-- .../components/sidebar-nav-bs.html | 3 ++ .../sections/sidebar-primary.html | 3 -- tests/test_build/navbar_ix.html | 39 +++++++++------- tests/test_build/sidebar_subpage.html | 45 ++++++++++--------- tests/test_build/test_sidebars_captions.html | 3 ++ .../test_build/test_sidebars_nested_page.html | 3 ++ 9 files changed, 77 insertions(+), 45 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_navbar-links.scss b/src/pydata_sphinx_theme/assets/styles/components/_navbar-links.scss index 5b22845d0..2493fc883 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_navbar-links.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_navbar-links.scss @@ -68,3 +68,8 @@ } } } + +// Don't display the `site navigation` in the header menu +.bd-header .navbar-nav > p.sidebar-header-items__title { + display: none; +} diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-primary.scss b/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-primary.scss index 714c8bde4..6ce31e20f 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-primary.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-primary.scss @@ -36,7 +36,7 @@ .sidebar-start-items__item, .sidebar-end-items__item { - padding: 0.25rem 0; + padding: 0.5rem 0; } // Hide the sidebar header items on widescreen since they are visible in the header @@ -202,9 +202,15 @@ nav.bd-links { } } + // Title + p.bd-links__title { + font-size: var(--pst-sidebar-header-font-size); + font-weight: var(--pst-sidebar-header-font-weight); + margin-bottom: 0.5rem; + } + // Toctree captions p.caption { - font-size: var(--pst-sidebar-header-font-size); font-weight: var(--pst-sidebar-header-font-weight); position: relative; margin-top: 1.25em; diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html index d4a41ed6a..4fa900557 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html @@ -1,3 +1,8 @@ - + diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html index d142e34a8..19235ff38 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html @@ -1,4 +1,7 @@