From ec46d154cab97387092be2df13af3b06a5826d49 Mon Sep 17 00:00:00 2001 From: gabalafou Date: Thu, 19 Dec 2024 03:37:02 -0600 Subject: [PATCH 1/2] BUG - center search modal on wide screens --- .../assets/styles/components/_search.scss | 49 +++++++------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_search.scss b/src/pydata_sphinx_theme/assets/styles/components/_search.scss index 630c6cd1f6..330784f1ce 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_search.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_search.scss @@ -82,39 +82,26 @@ /** * The search modal */ -#pst-search-dialog { - display: none; - - &[open] { - display: flex; - - // Center in middle of screen just underneath header - position: fixed; - z-index: $zindex-modal; - top: 30%; - left: 50%; - transform: translate(-50%, -50%); - right: 1rem; - margin-top: 0.5rem; - width: 90%; - max-width: 800px; - background-color: transparent; - padding: $focus-ring-width; - border: none; - - &::backdrop { - background-color: black; - opacity: 0.5; - } +#pst-search-dialog[open] { + margin: 25vh auto 0; // an open modal dialog has a fixed position, so these margins bring it 25% down the viewport height and center it horizontally + width: 90%; + max-width: 800px; + background-color: transparent; + padding: $focus-ring-width; + border: none; + + &::backdrop { + background-color: black; + opacity: 0.5; + } - form.bd-search { - flex-grow: 1; + form.bd-search { + flex-grow: 1; - // Font and input text a bit bigger - svg, - input { - font-size: var(--pst-font-size-icon); - } + // Font and input text a bit bigger + svg, + input { + font-size: var(--pst-font-size-icon); } } } From 12dd38fd0cb36ade61ab0b288b6ea7c527a83485 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Fri, 24 Jan 2025 11:03:14 -0600 Subject: [PATCH 2/2] restore bkgd to search results --- .../assets/styles/components/_search.scss | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_search.scss b/src/pydata_sphinx_theme/assets/styles/components/_search.scss index 15500d6e39..72a38f9d30 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_search.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_search.scss @@ -89,6 +89,7 @@ background-color: transparent; padding: $focus-ring-width; border: none; + height: 80vh; &::backdrop { background-color: black; @@ -103,23 +104,23 @@ input { font-size: var(--pst-font-size-icon); } + } + + /* In pydata-sphinx-theme.js this container is appended below + * the query input node after the user types their search query. + * Search results are populated into this container using Sphinx's + * built-in, JS-powered local search tools. */ + #search-results { + overflow-y: scroll; + background-color: var(--pst-color-background); + padding: 1em; + + a { + color: var(--pst-color-link); + } - /* In pydata-sphinx-theme.js this container is appended below - * the query input node after the user types their search query. - * Search results are populated into this container using Sphinx's - * built-in, JS-powered local search tools. */ - #search-results { - overflow-y: scroll; - background-color: var(--pst-color-background); - padding: 1em; - - a { - color: var(--pst-color-link); - } - - &.empty { - display: none; - } + &.empty { + display: none; } } }