diff --git a/docs/user_guide/layout.rst b/docs/user_guide/layout.rst index e4deded42..113cdcded 100644 --- a/docs/user_guide/layout.rst +++ b/docs/user_guide/layout.rst @@ -452,6 +452,7 @@ will be named accordingly). - ``navbar-logo.html`` - ``navbar-nav.html`` - ``page-toc.html`` +- ``searchbox.html`` - ``search-button.html`` - ``search-field.html`` - ``sidebar-ethical-ads.html`` diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-secondary.scss b/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-secondary.scss index 986eadfa6..37459a557 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-secondary.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_sidebar-secondary.scss @@ -52,3 +52,21 @@ padding-left: 1rem; } } + +// The 'Hide Search Matches' link +div#searchbox { + p.highlight-link { + // remove excess margin from p tag + margin-bottom: 0px; + a { + // add icon via CSS because the link is created by javascript + // match padding to .toc-item > i above + // f010 is magnifying glass minus + &:before { + content: "\f010"; + font-family: FontAwesome; + padding-right: 0.5rem; + } + } + } +} diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/searchbox.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/searchbox.html new file mode 100644 index 000000000..3437e8d27 --- /dev/null +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/searchbox.html @@ -0,0 +1,2 @@ +{# div#searchbox hosts the "Hide Search Matches" link #} + diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf index 4fd5b8d4e..821f3782c 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf @@ -34,7 +34,7 @@ navbar_end = theme-switcher.html, navbar-icon-links.html header_links_before_dropdown = 5 left_sidebar_end = sidebar-ethical-ads.html footer_items = copyright.html, sphinx-version.html -page_sidebar_items = page-toc.html, edit-this-page.html, sourcelink.html +page_sidebar_items = page-toc.html, searchbox.html, edit-this-page.html, sourcelink.html switcher = pygment_light_style = tango pygment_dark_style = native