Skip to content

Storybook polish: interactive theming controls for widgets (#64)#73

Open
Godbrand0 wants to merge 7 commits into
GoodDollar:mainfrom
Godbrand0:feat/storybook-controls-polish
Open

Storybook polish: interactive theming controls for widgets (#64)#73
Godbrand0 wants to merge 7 commits into
GoodDollar:mainfrom
Godbrand0:feat/storybook-controls-polish

Conversation

@Godbrand0

@Godbrand0 Godbrand0 commented Jul 1, 2026

Copy link
Copy Markdown

Summary

First increment of #64 (Polish storybook interaction and presentation). Focuses on the "controls" and "documentation" parts of the definition of done:
closes #64

  • Wires up Storybook argTypes controls for defaultTheme and themeOverrides (via a shared "brand preset" select: None/Cobalt/Teal) across all four widget showcase stories — StreamingWidget, CitizenClaimWidget, StakingMigrationWidget, and ClaimWidget Theme Demo — so integrators can flip theme/branding live in the Controls panel instead of editing story code.
  • Extracts the cobalt/teal override presets (previously local to claimWidgetStories.tsx) into a shared themeOverridePresets.ts helper reused by all widgets.
  • Adds argTypes + a Controllable story to the Card, GlowCard, Stepper, and Drawer design-system primitives, following the existing TokenAmount pattern.
  • Adds "How to mount it" integration code snippets to CitizenClaimWidget.mdx and StakingMigrationWidget.mdx to match ClaimWidget.mdx's existing depth, plus a one-line pointer to the new controls on all three widget docs pages.
  • Fixes a bug caught during manual visual verification: the Stepper Controllable story's activeStepId control only auto-scrolled the list without changing which step rendered as "active" (status was hardcoded in a static array). Now recomputes step status relative to the selected step.

All existing story ids / data-testids used by the Playwright QA suite are preserved — no QA fixture stories were touched.

Test plan

  • pnpm build (workspace packages) + pnpm build-storybook succeed
  • Manually verified in a running Storybook that defaultTheme and brandPreset controls visibly change each widget's rendering (screenshots taken via a scripted headless pass), and that Card/Stepper/Drawer controls visibly change their primitives
  • pnpm test:demo (Playwright) — 32 passed; 2 pre-existing failures in staking-migration-widget/states.spec.ts (ReadyStory/MigratingStory, untouched by this PR) appear to depend on live RPC access to rpc.fuse.io unavailable in this sandbox — not caused by this change
  • Remaining from the issue's DoD, tracked as follow-up: broader "human eye review" pass across QA state stories for all widgets, and any component-level issues found reported separately

Godbrand0 added 3 commits July 1, 2026 03:58
…tories

Adds interactive Storybook controls for defaultTheme and themeOverrides
across all four widget showcase stories (StreamingWidget, CitizenClaimWidget,
StakingMigrationWidget, ClaimWidget) plus the Card/GlowCard/Stepper/Drawer
design-system primitives, so integrators can experiment with theming live
in the Controls panel instead of editing story code. Extracts the cobalt/teal
brand override presets into a shared helper reused across widgets.
CitizenClaimWidget.mdx and StakingMigrationWidget.mdx were missing the
"How to mount it" code snippet that ClaimWidget.mdx already has, so
integrators had no copy-paste starting point for those two widgets.
Adds the same Source block pattern to both, and adds a one-line note
to all three widget docs pages (CitizenClaimWidget, StakingMigrationWidget,
StreamingWidget) pointing at the new defaultTheme/themeOverrides Storybook
controls added in this branch.
Found during manual visual verification of issue GoodDollar#64 (each control must
visibly change what renders): the Stepper Controllable story passed a
static STEPS array with hardcoded per-step `status` values, so moving the
`activeStepId` control only auto-scrolled the list — the blue "active"
highlight stayed pinned to whichever step had status:'active' in the
array (always "Submit migration"), regardless of the selected control
value. Now recomputes each step's status relative to the chosen
activeStepId so the control drives a real state change.
@Godbrand0 Godbrand0 requested review from a team and L03TJ3 July 1, 2026 09:45
Godbrand0 added 4 commits July 1, 2026 06:32
Found during manual verification: StreamingWidget's card surfaces use
their own named Tamagui theme keys (StreamRow, PoolRow, BalanceCard,
EmptyStateCard, ErrorStateCard, SetStreamFormCard — see
packages/streaming-widget/src/components/shared.tsx), none of which
overlap with the Claim-family keys (ClaimCard, ClaimActionGlow, etc.)
the shared cobalt/teal presets originally targeted. So toggling
brandPreset on the StreamingWidget showcase story changed nothing.

Adds matching border/shadow overrides for StreamingWidget's card names
to both presets so the control has a real effect there too.

StakingMigrationWidget already reuses the ClaimCard/StreakCard names
(packages/staking-migration-widget/src/migrationWidgetComponents.ts),
so it was already covered — it just isn't visible on the "no wallet"
fallback screen, since that screen renders plain text with no themed
Card at all.
The Controls panel is auto-generated for every story of a component,
so it appears (and looks interactive) on Default/WithAction-style
stories too — but their render functions use fixed hardcoded props
so those stories stay stable for other docs pages and Playwright
screenshot tests. Only the "Controllable" story actually reads args.
This was confusing during manual verification, so each Default story
across Card/GlowCard/Stepper/Drawer now says so explicitly.
… fallback

Found during manual verification: InjectedWalletStory threaded
themeOverrides through to StreamingWidgetStoryShell (the "wallet
connected" path) but not to PreviewStoryShell (the "no wallet"
fallback path, which most reviewers hit since they don't have a
matching injected wallet). So brandPreset silently did nothing on
the common case of that story. PreviewStoryShell and its underlying
StreamingWidgetPreview call now also receive themeOverrides.
…re stories

Per issue GoodDollar#64's literal DoD ("all stories are accompanied with controls"),
the QA runtime-fixture stories previously had zero controls. Threads
defaultTheme/themeOverrides through every QA helper function across all
three widgets (20 StreamingWidget states, 1 CitizenClaimWidget state, 8
StakingMigrationWidget states) and wires matching argTypes into each QA
story file, following the same pattern already used on the Showcase
stories.

QA determinism for Playwright is unaffected: automated tests navigate
directly to story IDs without touching the Controls panel, so the fixed
default args (dark theme, no brand preset) still apply during test runs.
A human reviewer gets the same live override on top when browsing QA
stories manually.

LightThemePopulated/LightThemeReady keep their hardcoded defaultTheme="light"
mount (that's the point of those specific stories) but now also accept the
brandPreset control on top.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GoodBounty]: Polish storybook interaction and presentation

1 participant