From 4dda15ab0df43670626a4f2f22ea8c39deb31082 Mon Sep 17 00:00:00 2001 From: ob-yalian Date: Thu, 26 Mar 2026 16:54:26 +0800 Subject: [PATCH] docs: simplify sidebar search --- docs/_ext/templates/searchbox.html | 21 +++++++ docs/en/source/_static/custom.css | 88 ++++++++++++++++++++++++++++++ docs/zh/source/_static/custom.css | 88 ++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 docs/_ext/templates/searchbox.html diff --git a/docs/_ext/templates/searchbox.html b/docs/_ext/templates/searchbox.html new file mode 100644 index 00000000..1c1154fa --- /dev/null +++ b/docs/_ext/templates/searchbox.html @@ -0,0 +1,21 @@ +{% set is_zh = language and language.startswith('zh') %} +{%- if 'singlehtml' not in builder %} +
+ + + + + {{ '全站搜索' if is_zh else 'Global Search' }} + + + {{ '搜索中文、英文、参数名和章节' if is_zh else 'Search docs, sections, and parameters' }} + + + +
+{%- endif %} diff --git a/docs/en/source/_static/custom.css b/docs/en/source/_static/custom.css index 08e60625..d366c9d4 100755 --- a/docs/en/source/_static/custom.css +++ b/docs/en/source/_static/custom.css @@ -39,6 +39,86 @@ margin-left: 8px !important; } +.wy-nav-side .wy-side-nav-search { + padding: 1rem 0.95rem 1.1rem !important; + background: linear-gradient(180deg, #1678b8 0%, #0f6aa5 100%) !important; + box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12) !important; +} + +.wy-nav-side .wy-side-nav-search > a.icon { + display: block !important; + margin-bottom: 0.9rem !important; + font-size: 1.02rem !important; + line-height: 1.35 !important; +} + +.wy-nav-side .sidebar-search-entry { + display: block !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut { + display: flex !important; + align-items: flex-start !important; + gap: 0.7rem !important; + padding: 0.85rem 0.9rem !important; + color: #ffffff !important; + text-decoration: none !important; + background: rgba(255, 255, 255, 0.12) !important; + border: 1px solid rgba(255, 255, 255, 0.2) !important; + border-radius: 14px !important; + box-shadow: 0 10px 24px rgba(11, 53, 84, 0.18) !important; + transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut:hover { + color: #ffffff !important; + background: rgba(255, 255, 255, 0.18) !important; + border-color: rgba(255, 255, 255, 0.34) !important; + transform: translateY(-1px) !important; + box-shadow: 0 14px 30px rgba(11, 53, 84, 0.22) !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-icon { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + width: 2rem !important; + height: 2rem !important; + min-width: 2rem !important; + border-radius: 999px !important; + background: rgba(255, 255, 255, 0.18) !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-icon svg { + width: 1rem !important; + height: 1rem !important; + fill: none !important; + stroke: currentColor !important; + stroke-width: 2 !important; + stroke-linecap: round !important; + stroke-linejoin: round !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-copy { + display: grid !important; + gap: 0.18rem !important; + min-width: 0 !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-title { + display: block !important; + font-size: 0.96rem !important; + font-weight: 700 !important; + line-height: 1.3 !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-text { + display: block !important; + font-size: 0.78rem !important; + line-height: 1.45 !important; + color: rgba(255, 255, 255, 0.88) !important; +} + @media (max-width: 768px) { .lang-switch { top: 10px !important; @@ -577,6 +657,14 @@ font-size: 1.45rem !important; } + .wy-nav-side .wy-side-nav-search { + padding: 0.9rem 0.8rem 1rem !important; + } + + .wy-nav-side .sidebar-search-entry__shortcut { + padding: 0.78rem 0.8rem !important; + } + .wy-nav-content .rst-content .section-search-form { flex-direction: column !important; gap: 0.7rem !important; diff --git a/docs/zh/source/_static/custom.css b/docs/zh/source/_static/custom.css index 08e60625..d366c9d4 100755 --- a/docs/zh/source/_static/custom.css +++ b/docs/zh/source/_static/custom.css @@ -39,6 +39,86 @@ margin-left: 8px !important; } +.wy-nav-side .wy-side-nav-search { + padding: 1rem 0.95rem 1.1rem !important; + background: linear-gradient(180deg, #1678b8 0%, #0f6aa5 100%) !important; + box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12) !important; +} + +.wy-nav-side .wy-side-nav-search > a.icon { + display: block !important; + margin-bottom: 0.9rem !important; + font-size: 1.02rem !important; + line-height: 1.35 !important; +} + +.wy-nav-side .sidebar-search-entry { + display: block !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut { + display: flex !important; + align-items: flex-start !important; + gap: 0.7rem !important; + padding: 0.85rem 0.9rem !important; + color: #ffffff !important; + text-decoration: none !important; + background: rgba(255, 255, 255, 0.12) !important; + border: 1px solid rgba(255, 255, 255, 0.2) !important; + border-radius: 14px !important; + box-shadow: 0 10px 24px rgba(11, 53, 84, 0.18) !important; + transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut:hover { + color: #ffffff !important; + background: rgba(255, 255, 255, 0.18) !important; + border-color: rgba(255, 255, 255, 0.34) !important; + transform: translateY(-1px) !important; + box-shadow: 0 14px 30px rgba(11, 53, 84, 0.22) !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-icon { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + width: 2rem !important; + height: 2rem !important; + min-width: 2rem !important; + border-radius: 999px !important; + background: rgba(255, 255, 255, 0.18) !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-icon svg { + width: 1rem !important; + height: 1rem !important; + fill: none !important; + stroke: currentColor !important; + stroke-width: 2 !important; + stroke-linecap: round !important; + stroke-linejoin: round !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-copy { + display: grid !important; + gap: 0.18rem !important; + min-width: 0 !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-title { + display: block !important; + font-size: 0.96rem !important; + font-weight: 700 !important; + line-height: 1.3 !important; +} + +.wy-nav-side .sidebar-search-entry__shortcut-text { + display: block !important; + font-size: 0.78rem !important; + line-height: 1.45 !important; + color: rgba(255, 255, 255, 0.88) !important; +} + @media (max-width: 768px) { .lang-switch { top: 10px !important; @@ -577,6 +657,14 @@ font-size: 1.45rem !important; } + .wy-nav-side .wy-side-nav-search { + padding: 0.9rem 0.8rem 1rem !important; + } + + .wy-nav-side .sidebar-search-entry__shortcut { + padding: 0.78rem 0.8rem !important; + } + .wy-nav-content .rst-content .section-search-form { flex-direction: column !important; gap: 0.7rem !important;