From b0d07267c129929206ec8505c0e7b114b99420b8 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 21 Mar 2025 11:45:45 +0000 Subject: [PATCH 1/4] Improvements to LH sidebar layout --- mpl_sphinx_theme/static/css/style.css | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mpl_sphinx_theme/static/css/style.css b/mpl_sphinx_theme/static/css/style.css index 4284099..046d29b 100644 --- a/mpl_sphinx_theme/static/css/style.css +++ b/mpl_sphinx_theme/static/css/style.css @@ -14,15 +14,23 @@ html[data-theme="dark"] { } :root { ---pst-color-link-hover: var(--pst-color-secondary); + --pst-color-link-hover: var(--pst-color-secondary); } -.sidebar-cheatsheets, .sidebar-donate { - margin: 2.75rem 0; +.sidebar-cheatsheets > h3 { + margin-top: 0; +} + +.sidebar-cheatsheets > img { + width: 100%; +} + +.sidebar-donate > .sd-btn { + width: 100%; } #navbar-icon-links { - margin-left: 1.5em; + margin-left: 1.5em; } #navbar-icon-links .nav-link { @@ -32,4 +40,3 @@ html[data-theme="dark"] { #navbar-icon-links .nav-link:hover { color: var(--pst-color-primary); } - From 1117ae84de9a80b4ee8ec8f5a6c6434c9a70dbf3 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 21 Mar 2025 12:13:51 +0000 Subject: [PATCH 2/4] Add donate sidebar to sample page --- docs/conf.py | 6 ++++++ mpl_sphinx_theme/donate_sidebar.html | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e148716..5697974 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,6 +61,12 @@ "navbar_links": "absolute", } +html_sidebars = { + "index": [ + "donate_sidebar.html", + ], +} + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". diff --git a/mpl_sphinx_theme/donate_sidebar.html b/mpl_sphinx_theme/donate_sidebar.html index a4a0777..9744abe 100644 --- a/mpl_sphinx_theme/donate_sidebar.html +++ b/mpl_sphinx_theme/donate_sidebar.html @@ -1,8 +1,5 @@ - - - + + Support Matplotlib + + From d0726f79bfae6b927c3a89bdd9133808677cb3ee Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 21 Mar 2025 12:39:02 +0000 Subject: [PATCH 3/4] Add sphinx design as a dependency --- docs/conf.py | 3 ++- pyproject.toml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 5697974..18b8e08 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,8 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'matplotlib.sphinxext.plot_directive', + "matplotlib.sphinxext.plot_directive", + "sphinx_design" ] # Add any paths that contain templates here, relative to this directory. diff --git a/pyproject.toml b/pyproject.toml index 55a2847..076ce2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ dependencies = [ "pydata-sphinx-theme>=0.13.1", "matplotlib", + "sphinx-design", ] [project.urls] From 48e5fcd873717a124247ebbeeefaa957510074f4 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 21 Mar 2025 12:44:58 +0000 Subject: [PATCH 4/4] Remove cheatsheet CSS --- mpl_sphinx_theme/static/css/style.css | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mpl_sphinx_theme/static/css/style.css b/mpl_sphinx_theme/static/css/style.css index 046d29b..fe65596 100644 --- a/mpl_sphinx_theme/static/css/style.css +++ b/mpl_sphinx_theme/static/css/style.css @@ -17,14 +17,6 @@ html[data-theme="dark"] { --pst-color-link-hover: var(--pst-color-secondary); } -.sidebar-cheatsheets > h3 { - margin-top: 0; -} - -.sidebar-cheatsheets > img { - width: 100%; -} - .sidebar-donate > .sd-btn { width: 100%; }