swarm-ui: compact refresh-interval picker, moved into the panel header

Per mara's review on this PR: the labelled SelectField-based picker
read as way too heavy for a passive-until-touched setting - a full
label+bordered-control form field row above the table. Replace it with
a compact inline "clock icon - value - chevron" control (a native
<select> still drives the interaction, just stripped of SelectField/
FormField's chrome), quiet until hovered/focused the same way
LinksMenu's header button is.

Also move it out of the panel body entirely: Panel gains an `actions`
slot in its title row (right-aligned via margin-left: auto), so the
picker sits next to the "hives" heading instead of taking its own row
and pushing the table down - per the design guide's own "a control
belongs next to the thing it affects" rule.

Verified with headless chromium screenshots (full page + a tight
close-up crop) against the built bundle: the picker now reads as
"(clock) 30s (chevron)" inline with the panel title, no extra vertical
space taken from the table. Added a Panel "with actions" demo to
ComponentsPage.
This commit is contained in:
iris 2026-08-18 22:49:04 +02:00 committed by mara
commit fc44891ab5
6 changed files with 139 additions and 21 deletions

View file

@ -101,6 +101,14 @@ export function ComponentsPage() {
<Sample label="without title">
<Panel>panel body content, no title</Panel>
</Sample>
<Sample label="with actions (e.g. HivesPage's refresh picker)">
<Panel
title="example title"
actions={<RefreshIntervalPicker id="sample-panel-actions" value={30_000} onChange={() => {}} />}
>
panel body content
</Panel>
</Sample>
</Section>
<Section title="StatusChip">

View file

@ -113,8 +113,10 @@ export function HivesPage() {
});
return (
<Panel title="hives">
<RefreshIntervalPicker id="hives-refresh" value={intervalMs} onChange={setIntervalMs} />
<Panel
title="hives"
actions={<RefreshIntervalPicker id="hives-refresh" value={intervalMs} onChange={setIntervalMs} />}
>
{error ? <ApiErrorPanel context="failed to load the hive roster" problem={error} /> : null}
{!error && hives === null ? <p>loading</p> : null}
{hives ? <Table columns={COLUMNS} rows={hives} rowKey={(h) => h.name} /> : null}