Skip to content

Commit 10e1fde

Browse files
samejrclaude
andcommitted
feat(webapp): complete the storybook's variant coverage
Audited every component against its story by extracting the variant keys each one declares. The gaps, now filled: - Buttons: was missing every extra-large size, the whole docs and ask-trigger families, secondary/small-icon and the three menu-item variants. Rewritten to drive off the family and size lists, so all 35 variants render and the page can't drift from the component again. - Popover: only the arrow trigger appeared. Now every trigger (custom, side menu, both ellipse orientations, plain), all four arrow variants, the layout options and each content side. - Tooltip: adds the dark variant, all four sides, the delay options and InfoIconTooltip. - Select: all six variants plus placeholder, dropdown icon, disabled and icon items, above the existing interactive demos. - Table: all four variants, the chevron/menu/blank-row cell types, and static ids in place of crypto.randomUUID() at render time. - Switch, Badge, InlineCode, SegmentedControl, Spinner and Shortcuts: rewritten to cover every variant, size and state. - Smaller fills: TextLink's three variants, Checkbox button/small, Input secondary-small, InfoPanel info, DetailCell small, CopyableText text-below, DurationPicker medium, AnimatingArrow extra-large. The agent gallery drops its own three-button theme toggle, now that the header control covers all five themes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 305c8b3 commit 10e1fde

66 files changed

Lines changed: 1295 additions & 692 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/webapp/app/routes/resources.account.mfa.setup/MfaDisableDialog.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,7 @@ export function MfaDisableDialog({
138138
</Button>
139139
<Button type="submit" variant="primary/medium" disabled={isSubmitting}>
140140
{isSubmitting ? <Spinner className="mr-2 size-5" color="white" /> : null}
141-
{isSubmitting ? (
142-
<span>Disabling…</span>
143-
) : (
144-
<span>Disable MFA</span>
145-
)}
141+
{isSubmitting ? <span>Disabling…</span> : <span>Disable MFA</span>}
146142
</Button>
147143
</DialogFooter>
148144
</Form>

apps/webapp/app/routes/storybook.accordion/route.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { StoryPage, StorySection } from "../storybook/StoryKit";
1010

1111
export default function Story_() {
1212
return (
13-
<StoryPage title="Accordion" description="Collapsible sections built on Radix Accordion.">
13+
<StoryPage
14+
componentNames={["Accordion.tsx"]}
15+
title="Accordion"
16+
description="Collapsible sections built on Radix Accordion."
17+
>
1418
<StorySection title="Single, collapsible">
1519
<div className="max-w-xl rounded-sm border border-grid-dimmed p-2">
1620
<Accordion type="single" collapsible>

apps/webapp/app/routes/storybook.agent-investigation/route.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,7 @@ const STATES: Record<string, React.ReactNode> = {
8383
};
8484

8585
export default function Story() {
86-
return <GalleryPage page="investigation" states={STATES} />;
86+
return (
87+
<GalleryPage page="investigation" states={STATES} componentNames={["InvestigationCard.tsx"]} />
88+
);
8789
}

apps/webapp/app/routes/storybook.agent-report/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ const STATES: Record<string, React.ReactNode> = {
2828
};
2929

3030
export default function Story() {
31-
return <GalleryPage page="report" states={STATES} />;
31+
return <GalleryPage page="report" states={STATES} componentNames={["ReportView.tsx"]} />;
3232
}

apps/webapp/app/routes/storybook.agent-ui/gallery.tsx

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { safeParseTriggerUri } from "@internal/dashboard-agent-contracts";
33
import { Header1, Header2 } from "~/components/primitives/Headers";
44
import { Paragraph } from "~/components/primitives/Paragraph";
55
import { cn } from "~/utils/cn";
6+
import { ComponentNames } from "../storybook/StoryKit";
67
import {
78
GALLERY_PAGES,
89
groupsOnPage,
@@ -54,24 +55,6 @@ function Section({
5455
);
5556
}
5657

57-
function ThemeToggle() {
58-
return (
59-
<div className="flex items-center gap-1.5">
60-
{/* classic is still the default theme for most users, so it's in the pack */}
61-
{(["classic", "dark", "light"] as const).map((theme) => (
62-
<button
63-
key={theme}
64-
type="button"
65-
onClick={() => document.documentElement.setAttribute("data-theme", theme)}
66-
className="rounded border border-border-bright bg-background-bright px-2 py-1 text-xs text-text-dimmed transition hover:text-text-bright"
67-
>
68-
{theme}
69-
</button>
70-
))}
71-
</div>
72-
);
73-
}
74-
7558
function PageLinks({ page }: { page: GalleryPageId }) {
7659
return (
7760
<div className="flex flex-wrap gap-1.5">
@@ -120,9 +103,12 @@ function Nav({ page }: { page: GalleryPageId }) {
120103
export function GalleryPage({
121104
page,
122105
states,
106+
componentNames,
123107
}: {
124108
page: GalleryPageId;
125109
states: Record<string, React.ReactNode>;
110+
/** Component files this page covers, shown copyable under the title. */
111+
componentNames?: string[];
126112
}) {
127113
const meta = GALLERY_PAGES.find((entry) => entry.id === page)!;
128114
const sections = sectionsOnPage(page);
@@ -134,8 +120,8 @@ export function GalleryPage({
134120
<div className="flex flex-col gap-2">
135121
<div className="flex items-baseline justify-between gap-4">
136122
<Header1>Trigger Agent — {meta.title}</Header1>
137-
<ThemeToggle />
138123
</div>
124+
{componentNames && componentNames.length > 0 && <ComponentNames names={componentNames} />}
139125
<PageLinks page={page} />
140126
<Paragraph variant="small">
141127
{meta.blurb} {sections.length} states, rendered in isolation at panel width (380px) from
@@ -145,8 +131,8 @@ export function GalleryPage({
145131
</Paragraph>
146132
<Paragraph variant="extra-small">
147133
Run ids, queues, errors and reports are fabricated. Deep links resolve inside a project,
148-
so here they render as plain text or navigate nowhere. The theme buttons flip{" "}
149-
<code className="font-mono text-xs">data-theme</code> on the root element.
134+
so here they render as plain text or navigate nowhere. Use the theme control in the
135+
storybook header to switch themes.
150136
</Paragraph>
151137
</div>
152138

apps/webapp/app/routes/storybook.agent-ui/route.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,5 +333,15 @@ const STATES: Record<string, React.ReactNode> = {
333333
};
334334

335335
export default function Story() {
336-
return <GalleryPage page="chat" states={STATES} />;
336+
return (
337+
<GalleryPage
338+
page="chat"
339+
states={STATES}
340+
componentNames={[
341+
"DashboardAgentComposer.tsx",
342+
"DashboardAgentMessages.tsx",
343+
"DashboardAgentHero.tsx",
344+
]}
345+
/>
346+
);
337347
}

apps/webapp/app/routes/storybook.agent-view-blocks/route.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,11 @@ const STATES: Record<string, React.ReactNode> = {
120120
};
121121

122122
export default function Story() {
123-
return <GalleryPage page="view-blocks" states={STATES} />;
123+
return (
124+
<GalleryPage
125+
page="view-blocks"
126+
states={STATES}
127+
componentNames={["AgentChart.tsx", "RunDiagnosisCard.tsx", "agent-card.tsx"]}
128+
/>
129+
);
124130
}

apps/webapp/app/routes/storybook.agent-watch/route.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,11 @@ const STATES: Record<string, React.ReactNode> = {
120120
};
121121

122122
export default function Story() {
123-
return <GalleryPage page="watch" states={STATES} />;
123+
return (
124+
<GalleryPage
125+
page="watch"
126+
states={STATES}
127+
componentNames={["WatchCard.tsx", "WatchResultBlock.tsx", "WatchWakeToast.tsx"]}
128+
/>
129+
);
124130
}

apps/webapp/app/routes/storybook.ai-agent/route.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ComponentNames } from "../storybook/StoryKit";
12
import { type CSSProperties, useEffect, useMemo, useRef, useState } from "react";
23
import { LogoIcon } from "~/components/LogoIcon";
34
import { Button, type ButtonVariant } from "~/components/primitives/Buttons";
@@ -26,6 +27,9 @@ import {
2627
export default function Story() {
2728
return (
2829
<div className="flex flex-col gap-4 p-6">
30+
<div className="px-4 pt-4">
31+
<ComponentNames names={["AgentDotMatrix.tsx"]} />
32+
</div>
2933
<div className="flex max-w-3xl flex-col gap-1">
3034
<Header1>Trigger Agent — Icons & Buttons</Header1>
3135
<Paragraph variant="small">

apps/webapp/app/routes/storybook.animated-panel/route.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ComponentNames } from "../storybook/StoryKit";
12
import { useState } from "react";
23
import { ExitIcon } from "~/assets/icons/ExitIcon";
34
import { Button } from "~/components/primitives/Buttons";
@@ -166,6 +167,9 @@ export default function Story() {
166167

167168
return (
168169
<div className="h-full">
170+
<div className="px-4 pt-4">
171+
<ComponentNames names={["Resizable.tsx", "PropertyTable.tsx"]} />
172+
</div>
169173
<ResizablePanelGroup orientation="horizontal" className="max-h-full">
170174
<ResizablePanel id="animated-panel-main" min="200px">
171175
<div className="grid h-full max-h-full grid-rows-[2.5rem_1fr] overflow-hidden">

0 commit comments

Comments
 (0)