search: pagination and scroll, add range counter, mobile version

This commit is contained in:
Pontoporeia
2026-07-03 16:53:16 +02:00
parent e607833b2e
commit 880d169e72
8 changed files with 378 additions and 116 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ var editor = new OT(document.getElementById('editor'), {
}
});
JS;
} elseif ($editType === 'apropos') {
} elseif ($editType === 'apropos' || $editType === 'about_page') {
$extraJs = ["/assets/js/app/autosave-handler.js"];
}
+177 -7
View File
@@ -8,6 +8,36 @@
min-height: 0;
overflow: hidden;
padding: 0;
display: flex;
flex-direction: column;
}
/* ── Scrollable results area with sticky pagination ──────────────── */
#search-results {
flex: 1;
min-height: 0;
overflow-y: auto;
display: flex;
flex-direction: column;
}
.search-results-header {
flex-shrink: 0;
}
.search-results-range--compact {
display: none;
}
.search-empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: var(--space-xl) var(--space-m);
color: var(--text-secondary);
font-size: var(--step-0);
text-align: center;
}
/* ---- 6-column index layout ---- */
@@ -510,7 +540,23 @@
justify-content: center;
align-items: center;
gap: var(--space-2xs);
padding: var(--space-m) 0;
padding: var(--space-s) 0;
position: sticky;
bottom: 0;
background: var(--bg-primary);
z-index: 10;
flex-shrink: 0;
margin-top: auto;
border-top: 1px solid var(--border-secondary);
}
.pagination-wrap ul {
display: flex;
align-items: center;
gap: var(--space-2xs);
list-style: none;
margin: 0;
padding: 0;
}
.pagination-btn {
@@ -546,12 +592,6 @@
padding: 0 var(--space-2xs);
}
.search-empty {
padding: var(--space-xl) var(--space-m);
color: var(--text-secondary);
font-size: var(--step-0);
text-align: center;
}
/* Error message */
.search-error {
@@ -675,3 +715,133 @@
color: var(--text-secondary, #888);
line-height: 1.5;
}
/* ── Collapsible filter controls ─────────────────────────────────── */
.search-filters-toggle {
flex-shrink: 0;
border-bottom: 1px solid var(--border-secondary);
}
.search-filters-summary {
display: none; /* hidden on desktop */
align-items: center;
gap: var(--space-2xs);
padding: var(--space-xs) var(--space-m);
font-size: var(--step--2);
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-secondary);
cursor: pointer;
list-style: none;
user-select: none;
min-height: 44px;
}
.search-filters-summary::-webkit-details-marker {
display: none;
}
.search-filters-summary::after {
content: '';
display: inline-block;
width: 8px;
height: 8px;
margin-left: auto;
border-right: 2px solid var(--text-secondary);
border-bottom: 2px solid var(--text-secondary);
transform: rotate(45deg);
transition: transform 0.2s;
}
.search-filters-toggle[open] .search-filters-summary::after {
transform: rotate(-135deg);
}
.search-filters-badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 1.4em;
height: 1.4em;
padding: 0 0.35em;
background: var(--accent-primary);
color: var(--accent-foreground);
border-radius: 99px;
font-size: 0.85em;
font-weight: 500;
letter-spacing: 0;
}
/* ── Responsive: mobile (≤ 768px) ────────────────────────────────── */
@media (max-width: 768px) {
/* Show filter toggle summary, collapse by default if no filters active */
.search-filters-summary {
display: flex;
}
.search-filters-toggle:not([open]) .search-controls {
display: none;
}
.search-filters-toggle[open] .search-controls {
display: flex;
}
/* Filters stack vertically on mobile */
.search-controls {
flex-direction: column;
align-items: stretch;
gap: var(--space-xs);
padding: var(--space-xs) var(--space-m);
}
.search-filter-label {
flex-direction: column;
align-items: stretch;
gap: var(--space-3xs);
}
.search-filter-select {
width: 100%;
}
.search-apply-btn,
.search-reset-link {
width: 100%;
text-align: center;
}
/* Pagination: hide first/last edge buttons */
.pagination-edge {
display: none;
}
.pagination-btn {
min-width: 2.25rem;
min-height: 2.25rem;
font-size: var(--step--2);
}
.pagination-info {
font-size: var(--step--2);
}
/* Reduce results grid gaps and padding */
.results-grid {
gap: var(--space-s);
padding: var(--space-2xs) var(--space-s) var(--space-s);
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.search-results-header {
margin: var(--space-s) var(--space-s) var(--space-2xs);
}
.search-results-range {
display: none;
}
.search-results-range--compact {
display: inline;
}
}
@@ -61,6 +61,9 @@ function handleAutosaveResponse(event) {
}
}
// Expose globally for HTMX hx-on::after-request inlines (bundles wrap in IIFE)
window.handleAutosaveResponse = handleAutosaveResponse;
// Show saving indicator while request is in flight
document.body.addEventListener("htmx:beforeRequest", (e) => {
const url = e.detail.requestConfig?.path || "";