docs: simplify sidebar search

This commit is contained in:
ob-yalian
2026-03-26 16:54:26 +08:00
parent b4e5346e52
commit 4dda15ab0d
3 changed files with 197 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
{% set is_zh = language and language.startswith('zh') %}
{%- if 'singlehtml' not in builder %}
<div class="sidebar-search-entry">
<a class="sidebar-search-entry__shortcut" href="{{ pathto('search') }}" aria-label="{{ '打开搜索页面' if is_zh else 'Open search page' }}">
<span class="sidebar-search-entry__shortcut-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
<circle cx="11" cy="11" r="6.5"></circle>
<path d="M16 16 L21 21"></path>
</svg>
</span>
<span class="sidebar-search-entry__shortcut-copy">
<span class="sidebar-search-entry__shortcut-title">
{{ '全站搜索' if is_zh else 'Global Search' }}
</span>
<span class="sidebar-search-entry__shortcut-text">
{{ '搜索中文、英文、参数名和章节' if is_zh else 'Search docs, sections, and parameters' }}
</span>
</span>
</a>
</div>
{%- endif %}
+88
View File
@@ -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;
+88
View File
@@ -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;