Improve serach function with quick suggestions

This commit is contained in:
2026-05-18 15:10:34 +02:00
parent 8244874fe3
commit a25d5434ac
8 changed files with 545 additions and 61 deletions
+101 -6
View File
@@ -72,22 +72,36 @@ a:hover {
color: var(--link-hover);
}
/* === Header === */
/* === Header ===
Three-column grid (breadcrumbs left, search centre, actions right) using
named grid-areas so the centre stays reserved even when search is hidden
in editor mode. Mobile (≤1100px) collapses to a two-row layout — see the
responsive block at the bottom of this file. */
header {
padding: 0.75rem 1rem;
border-bottom: 1px dashed var(--secondary);
display: flex;
display: grid;
grid-template-columns: 1fr minmax(0, auto) 1fr;
grid-template-areas: "crumbs search actions";
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.breadcrumb {
grid-area: crumbs;
display: flex;
align-items: center;
gap: 0.25rem;
min-width: 0;
}
.header-actions {
grid-area: actions;
display: flex;
align-items: center;
gap: 0.5rem;
justify-content: flex-end;
flex-wrap: wrap;
flex: 1;
}
.logo {
@@ -96,8 +110,14 @@ header {
vertical-align: center;
}
.sep {
.nav-up {
display: inline-flex;
align-items: center;
color: var(--secondary);
padding: 0 0.25rem;
}
.nav-up:hover {
color: var(--primary-hover);
}
.btn {
@@ -429,8 +449,13 @@ textarea {
/* === Search === */
.search-form {
grid-area: search;
display: flex;
gap: 0.25rem;
position: relative;
justify-self: center;
width: 24rem;
max-width: 100%;
}
.search-input {
background: var(--bg-panel);
@@ -440,13 +465,73 @@ textarea {
font-size: 0.9rem;
padding: 0.3rem 0.5rem;
min-width: 0;
width: 12rem;
width: 100%;
max-width: 100%;
outline: none;
}
.search-input:focus {
border-color: var(--primary-hover);
}
/* === Suggestion dropdown (header + editor link picker) ===
Anchored to a position:relative host (search-form, or the modal body
for the link picker). Visuals mirror .dropdown-menu — dashed border,
bg-panel-hover for the active row. */
.suggest-host {
position: relative;
}
.suggest-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
z-index: 200;
background: var(--bg-panel);
border: 1px dashed var(--secondary);
border-top: none;
display: none;
}
.suggest-dropdown.is-open {
display: block;
}
.suggest-row {
display: flex;
flex-direction: column;
gap: 0.1rem;
padding: 0.4rem 0.6rem;
cursor: pointer;
border: none;
background: none;
color: inherit;
font: inherit;
text-align: left;
width: 100%;
}
.suggest-row + .suggest-row {
border-top: 1px solid var(--secondary);
}
.suggest-row:hover,
.suggest-row.is-active {
background: var(--bg-panel-hover);
}
.suggest-row.is-empty {
color: var(--text-muted);
cursor: default;
}
.suggest-row.is-empty:hover {
background: none;
}
.suggest-name {
color: var(--text);
}
.suggest-path {
color: var(--text-muted);
font-size: 0.8rem;
}
.suggest-footer {
color: var(--link);
font-size: 0.85rem;
}
.search-card {
display: flex;
flex-direction: column;
@@ -880,6 +965,16 @@ aside.sidebar:empty {
.page-wrap {
grid-template-columns: 1fr;
}
/* Single-row mobile header: logo + Up icon are compact so search
can take the middle flex column, with actions on the right. */
header {
grid-template-columns: auto 1fr auto;
}
.search-form {
width: 100%;
max-width: none;
justify-self: stretch;
}
/* Sidebar on mobile is a floating overlay toggled by the FAB. The aside
itself is the scroll container; its children render at natural height. */
.sidebar {