swarm-ui: shared Hint, ActionRow, Toolbar, EmptyState, ExternalLink and ExpandableCard replace per-page copies
Hint, ActionRow, Toolbar, EmptyState and ExternalLink replace the muted text, button row, refresh bar, empty line and _blank anchor that each page restyled under its own class. ExpandableCard (with a loading twin) holds the builds and recent-runs cards, which had identical head and body CSS. The create form's raw checkbox becomes CheckboxField. The components page shows each new piece.
This commit is contained in:
parent
b74b5e77e4
commit
8a2e5203ad
1 changed files with 689 additions and 427 deletions
|
|
@ -34,6 +34,15 @@ import {
|
|||
import { CheckboxField } from "../ui/checkbox-field/CheckboxField.js";
|
||||
import { Button, type ButtonVariant } from "../ui/button/Button.js";
|
||||
import { Dialog } from "../ui/dialog/Dialog.js";
|
||||
import { ActionRow } from "../ui/action-row/ActionRow.js";
|
||||
import { EmptyState } from "../ui/empty-state/EmptyState.js";
|
||||
import {
|
||||
ExpandableCard,
|
||||
ExpandableCardSkeleton,
|
||||
} from "../ui/expandable-card/ExpandableCard.js";
|
||||
import { ExternalLink } from "../ui/external-link/ExternalLink.js";
|
||||
import { Hint, type HintTone } from "../ui/hint/Hint.js";
|
||||
import { Toolbar } from "../ui/toolbar/Toolbar.js";
|
||||
import { ConfirmDialog } from "../ui/confirm-dialog/ConfirmDialog.js";
|
||||
import { Popover } from "../ui/popover/Popover.js";
|
||||
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
|
||||
|
|
@ -41,6 +50,8 @@ import { GearIcon } from "@hive/shared/icons.js";
|
|||
import { Dropdown, type DropdownOption } from "@hive/shared/dropdown.js";
|
||||
import "./ComponentsPage.css";
|
||||
|
||||
const HINT_TONES: HintTone[] = ["muted", "warn", "error", "ok"];
|
||||
|
||||
function Section({
|
||||
title,
|
||||
children,
|
||||
|
|
@ -590,6 +601,62 @@ export function ComponentsPage() {
|
|||
</div>
|
||||
</Section>
|
||||
|
||||
<Section title="Hint">
|
||||
<div class="components-chip-row">
|
||||
{HINT_TONES.map((tone) => (
|
||||
<Sample key={tone} label={tone}>
|
||||
<Hint tone={tone}>A line of supporting text.</Hint>
|
||||
</Sample>
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<Section title="ActionRow, Toolbar, EmptyState, ExternalLink">
|
||||
<Sample label="ActionRow: the buttons that end a form">
|
||||
<ActionRow>
|
||||
<Button variant="primary">save</Button>
|
||||
<Button>cancel</Button>
|
||||
</ActionRow>
|
||||
</Sample>
|
||||
<Sample label="Toolbar: the bar above a list">
|
||||
<Toolbar>
|
||||
<Button>refresh</Button>
|
||||
</Toolbar>
|
||||
</Sample>
|
||||
<Sample label="EmptyState">
|
||||
<EmptyState>Nothing here yet.</EmptyState>
|
||||
</Sample>
|
||||
<Sample label="ExternalLink">
|
||||
<ExternalLink href="https://example.com">example.com</ExternalLink>
|
||||
</Sample>
|
||||
</Section>
|
||||
|
||||
<Section title="ExpandableCard">
|
||||
<Sample label="closed, open, and the loading twin">
|
||||
<ExpandableCard
|
||||
id="components-expandable-closed"
|
||||
open={false}
|
||||
onToggle={() => {}}
|
||||
title="build 1"
|
||||
badge={<Badge value="ok" />}
|
||||
meta="2 minutes ago"
|
||||
>
|
||||
body
|
||||
</ExpandableCard>
|
||||
<ExpandableCard
|
||||
id="components-expandable-open"
|
||||
open
|
||||
onToggle={() => {}}
|
||||
title="build 2"
|
||||
badge={<Badge value="failed" />}
|
||||
meta="an hour ago"
|
||||
>
|
||||
<Hint>The body appears while the card is open.</Hint>
|
||||
</ExpandableCard>
|
||||
<ExpandableCardSkeleton />
|
||||
</Sample>
|
||||
</Section>
|
||||
|
||||
<Section title="Dialog">
|
||||
<Sample label="modal, caller-owned content">
|
||||
<DialogSample />
|
||||
|
|
|
|||
Loading…
Reference in a new issue