ff
This commit is contained in:
178
src/styles/docs-nextra-search.css
Normal file
178
src/styles/docs-nextra-search.css
Normal file
@@ -0,0 +1,178 @@
|
||||
/* Nextra 风格文档搜索(仅作用于 .docs-spotlight*,不引入 theme 全局 reset) */
|
||||
|
||||
.docs-spotlight {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.docs-spotlight__input {
|
||||
width: 100%;
|
||||
min-height: 2.25rem;
|
||||
padding: 0.5rem 4.25rem 0.5rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid transparent;
|
||||
background: rgb(0 0 0 / 0.05);
|
||||
color: var(--color-ink);
|
||||
transition:
|
||||
background-color 0.15s ease,
|
||||
box-shadow 0.15s ease,
|
||||
border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.docs-spotlight__input::placeholder {
|
||||
color: var(--color-body);
|
||||
}
|
||||
|
||||
.docs-spotlight__input--focus,
|
||||
.docs-spotlight__input:focus {
|
||||
outline: none;
|
||||
background: rgb(255 255 255 / 0.95);
|
||||
border-color: var(--color-border-light);
|
||||
box-shadow: 0 0 0 2px rgb(38 112 232 / 0.18);
|
||||
}
|
||||
|
||||
.docs-spotlight__input::-webkit-search-cancel-button {
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.docs-spotlight__kbd {
|
||||
position: absolute;
|
||||
inset-block: auto;
|
||||
inset-inline-end: 0.375rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
height: 1.25rem;
|
||||
padding: 0 0.375rem;
|
||||
font-family: var(--font-mono-caps);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-body);
|
||||
pointer-events: none;
|
||||
border: 1px solid var(--color-border-light);
|
||||
border-radius: 0.25rem;
|
||||
background: rgb(255 255 255 / 0.9);
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.docs-spotlight__kbd--hidden {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
@media (width < 640px) {
|
||||
.docs-spotlight__kbd {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.docs-spotlight__input {
|
||||
padding-inline-end: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Headless UI 浮层可能挂在 body 下,用 :has 限定在文档路由 */
|
||||
html:has(.docs-page) .docs-spotlight__panel {
|
||||
z-index: 45;
|
||||
width: min(100vw - 2rem, 36rem);
|
||||
max-height: min(calc(100vh - 6rem), 400px);
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
padding: 0.625rem 0;
|
||||
border: 1px solid var(--color-border-light);
|
||||
border-radius: 0.75rem;
|
||||
background: rgb(255 255 255 / 0.92);
|
||||
backdrop-filter: blur(12px);
|
||||
box-shadow: var(--shadow-surface-hover);
|
||||
transition:
|
||||
opacity 0.2s ease,
|
||||
transform 0.2s ease;
|
||||
}
|
||||
|
||||
html:has(.docs-page) .docs-spotlight__panel[data-closed] {
|
||||
opacity: 0;
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
.docs-spotlight__state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
min-height: 7rem;
|
||||
padding: 1rem 1.5rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--color-body);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.docs-spotlight__state--error {
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
color: #c62828;
|
||||
}
|
||||
|
||||
.docs-spotlight__state-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.docs-spotlight__group-title {
|
||||
margin: 0.5rem 0.625rem 0.375rem;
|
||||
padding: 0 0.5rem 0.25rem;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-body-light);
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
}
|
||||
|
||||
.docs-spotlight__group-title:first-child {
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.docs-spotlight__hit {
|
||||
display: block;
|
||||
margin: 0 0.35rem;
|
||||
padding: 0.5rem 0.625rem;
|
||||
border-radius: 0.375rem;
|
||||
text-decoration: none;
|
||||
color: var(--color-ink-soft);
|
||||
scroll-margin-top: 6rem;
|
||||
}
|
||||
|
||||
.docs-spotlight__hit-title {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.docs-spotlight__hit-excerpt {
|
||||
margin-top: 0.25rem;
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.4;
|
||||
color: var(--color-body);
|
||||
}
|
||||
|
||||
.docs-spotlight__hit-excerpt mark {
|
||||
background: rgb(38 112 232 / 0.72);
|
||||
color: #fff;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.docs-spotlight__hit--focus,
|
||||
.docs-spotlight__hit[data-focus] {
|
||||
background: rgb(38 112 232 / 0.08);
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.docs-spotlight__hit--focus .docs-spotlight__hit-title,
|
||||
.docs-spotlight__hit[data-focus] .docs-spotlight__hit-title {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
Reference in New Issue
Block a user