diff --git a/frontend/src/components/ds/ListToolbar.jsx b/frontend/src/components/ds/ListToolbar.jsx new file mode 100644 index 00000000..485bcbf7 --- /dev/null +++ b/frontend/src/components/ds/ListToolbar.jsx @@ -0,0 +1,38 @@ +import { cn } from '@/lib/utils'; + +// The one list toolbar. Every list page used to hand-roll its own header row +// (.dom-listhead, .cron-listhead, .bk-listhead, .servers-listhead, +// .incidents-listhead, .wp-list__toolbar…) — same anatomy, a dozen names. +// This component is the anatomy: +// +// [title?] [filters] [children] [count?] [tools] +// +// } // primary quick filters, left +// count={<>12 of 20 jobs · 8 active} // mono meta, right +// tools={<>} +// > +// {/* optional extras between filters and the right group (e.g. a select) */} +// +// +// Placement rule (see AGENTS.md "Page anatomy"): page-level actions, +// FilterButton and SearchField live in the shared topbar; quick filters, +// counts and the table menus live here. +export function ListToolbar({ title, filters, count, tools, children, className }) { + return ( +
+ {title &&

{title}

} + {filters} + {children} + {(count || tools) && ( +
+ {count && {count}} + {tools} +
+ )} +
+ ); +} + +export default ListToolbar; diff --git a/frontend/src/components/ds/index.js b/frontend/src/components/ds/index.js index 871ad1fa..03b48876 100644 --- a/frontend/src/components/ds/index.js +++ b/frontend/src/components/ds/index.js @@ -24,5 +24,6 @@ export { SortChipBar } from './SortChipBar'; export { ColumnsMenu } from './ColumnsMenu'; export { DataTableFooter } from './DataTableFooter'; export { ViewMenu } from './ViewMenu'; +export { ListToolbar } from './ListToolbar'; export { ResourceCard, ResourceList } from './ResourceCard'; export { svcGrad, initials, gaugeColor } from './utils'; diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss index 3807b986..9a65a619 100644 --- a/frontend/src/styles/components/_design-system.scss +++ b/frontend/src/styles/components/_design-system.scss @@ -795,6 +795,62 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); to { opacity: 1; transform: translateX(-50%) translateY(0); } } +// ------------------------------------------------------------ +// ListToolbar (.sk-listhead) — the one list-page toolbar row. Replaces the +// per-page listheads (.dom-listhead, .cron-listhead, .servers-listhead…). +// [title] [filters] [extras] [count] [tools] +// ------------------------------------------------------------ +.sk-listhead { + display: flex; + align-items: center; + gap: $space-3; + flex-wrap: wrap; + margin-bottom: $space-3; + + &__title { + margin: 0; + font-size: 14px; + font-weight: 600; + letter-spacing: -0.01em; + color: var(--text); + } + + &__right { + display: flex; + align-items: center; + gap: $space-2; + margin-left: auto; + } + + &__count { + display: inline-flex; + align-items: center; + gap: 6px; + font-family: var(--mono); + font-size: 11.5px; + color: var(--text-faint); + white-space: nowrap; + + b { color: var(--text-dim); font-weight: 600; } + } + + // Secondary pickers (server/group selects) that live in the toolbar. + &__select { + height: 32px; + padding: 0 $space-3; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface-2); + color: var(--text-dim); + font-size: 12.5px; + font-family: inherit; + } + + @media (max-width: $breakpoint-md) { + &__right { width: 100%; margin-left: 0; } + } +} + // ------------------------------------------------------------ // wp-list chrome — the ResourceListPage list scaffold (status seg + search // toolbar, table card, optional card grid). Restores the canonical layout