diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css index 7b1f513aa5..a374fda4d3 100644 --- a/doc/_static/css/custom.css +++ b/doc/_static/css/custom.css @@ -552,7 +552,10 @@ kbd, .kbd, background-color: var(--navbar-background-color-active); } -.wy-side-nav-search input[type="text"] { +.wy-side-nav-search input[type=search] { + width: 100%; + border-radius: 50px; + padding: 6px 12px; background-color: var(--input-background-color); color: var(--body-color); /* Avoid reflowing when toggling the focus state */ @@ -563,11 +566,11 @@ kbd, .kbd, font-size: 14px; } -.wy-side-nav-search input[type="text"]:focus { +.wy-side-nav-search input[type="search"]:focus { border: 2px solid var(--input-focus-border-color); } -.wy-side-nav-search input[type="text"]::placeholder { +.wy-side-nav-search input[type="search"]::placeholder { color: var(--body-color); opacity: 0.55; } @@ -889,3 +892,61 @@ dark-mode-toggle::part(toggleLabel){ font-size: 3rem; color: white; } + +/* Custom search box, including search engine selection */ + +.search-container { + position: relative; +} + +#search-se-settings-icon { + position: absolute; + color: var(--body-color); + right: 10px; + top: 50%; + transform: translateY(-50%); + cursor: pointer; + opacity: 0.8; +} + +#search-se-menu { + display: none; + position: absolute; + font-size: 11px; + background-color: var(--input-background-color); + color: var(--body-color); + right: 0px; + top: 36px; + border: solid 1px var(--body-color); + border-radius: 10px; + z-index: 1000; +} + +#search-se-menu ul { + list-style: none; + margin: 0; + padding: 2px; +} + +#search-se-menu ul li { + padding: 8px 12px; + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; + gap: 1em; +} + +#search-se-menu [role="menuitemradio"]:focus { + background-color: var(--navbar-current-background-color-hover); + color: var(--navbar-level-1-color); + border-radius: 10px; +} + +#search-se-menu ul li .fa-check { + display: none; + } + + #search-se-menu ul li.selected .fa-check { + display: inline; + } diff --git a/doc/_templates/gsearch.html b/doc/_templates/gsearch.html new file mode 100644 index 0000000000..1953466355 --- /dev/null +++ b/doc/_templates/gsearch.html @@ -0,0 +1,17 @@ +{%- extends "!search.html" %} + +{%- block scripts %} + {{ super.super() }} + +{%- endblock %} + +{% block footer %} + {{ super.super() }} +{% endblock %} + +{% block body %} +

{{ _('Search Results') }}

+ +
+{% endblock %} diff --git a/doc/_templates/search.html b/doc/_templates/search.html deleted file mode 100644 index ee9343cce0..0000000000 --- a/doc/_templates/search.html +++ /dev/null @@ -1,28 +0,0 @@ -{%- extends "!search.html" %} -{%- block scripts %} - {% if google_searchengine_id %} - {{ super.super() }} - - {% else %} - {{ super() }} - {% endif %} -{%- endblock %} - -{% block footer %} - {% if google_searchengine_id %} - {{ super.super() }} - {% else %} - {{ super() }} - {% endif %} -{% endblock %} - -{% block body %} - {% if google_searchengine_id %} -

{{ _('Search Results') }}

- -
- {% else %} - {{ super() }} - {% endif %} -{% endblock %} diff --git a/doc/_templates/searchbox.html b/doc/_templates/searchbox.html new file mode 100644 index 0000000000..4779a49c03 --- /dev/null +++ b/doc/_templates/searchbox.html @@ -0,0 +1,130 @@ +{# + Override the default searchbox from RTD theme to provide the ability to select a search method + (ex. built-in search, Google Custom Search, ...) +#} +{%- if ('singlehtml' not in builder) %} + +{%- if google_searchengine_id is defined %} + +{%- endif %} +{%- endif %} \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index a01f51f687..af4b11fd0b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -153,6 +153,9 @@ html_split_index = True html_show_sourcelink = False html_show_sphinx = False html_search_scorer = str(ZEPHYR_BASE / "doc" / "_static" / "js" / "scorer.js") +html_additional_pages = { + "gsearch": "gsearch.html" +} is_release = tags.has("release") # pylint: disable=undefined-variable reference_prefix = ""