Repository navigation
Conversation
…n Theme overrides
…hes with mock provider
…d add theme screenshots
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(storybook): finalize widget showcase for #253 (closes #264)
Summary
Finalizes PR #253 (closing #264) by addressing theme override background no-ops, fixing environment switching in the CitizenClaim showcase, extracting shared Storybook options, updating integrator docs, and adding Playwright dynamic in-place tests with committed UI evidence.
Zero changes to
packages/*. All updates are strictly scoped toexamples/storybookandtests/widgets.Acceptance Criteria Checklist
swapShellBackground(backgroundSurface),amountCardBackground(backgroundInput), andsubmitButtonBackground(Button).cardBackground(backgroundDark) andbuttonBackground(Button).heroBackground(backgroundSurface) andbuttonBackground(Button).dark_Card.backgroundcontrols and addedDocsCalloutexplaining that base theme tokens cascade to all internal surfaces across each widget.key={environment}to<CitizenClaimWidget>insideCitizenClaimWidgetStoryShellso it remounts on environment toggle and drops stale data.ENVIRONMENT_OPTIONStoexamples/storybook/src/stories/helpers/environmentOptions.ts.tests/widgets/*/test-results/.Root Cause Analysis
Bug 1: Card background controls were no-ops in Theme Overrides
AiCreditsHero.tsxsetsbackgroundColor="$backgroundSurface"directly in JSX. In Tamagui, explicit style props take precedence over component defaults (dark_Card.background). Wired the background control to base tokensthemes.dark.backgroundSurface/themes.light.backgroundSurface.backgroundColor="$backgroundDark"directly on<Card>. Overrides ondark_Card.backgroundhave no effect. Wired the control tothemes.dark.backgroundDark/themes.light.backgroundDark, restored the Button override control, and corrected misleading MDX copy.ReserveSwapShellsetsbackgroundColor: '$backgroundSurface'andReserveAmountCardsetsbackgroundColor: '$backgroundInput'. Overridingdark_Card.backgrounddid nothing. Wired controls tobackgroundSurface(shell) andbackgroundInput(amount card), and corrected story header comments.Bug 2: CitizenClaimWidget environment change did not refresh
[isConnected, address, chainId], omittingenvironment.key={environment}to<CitizenClaimWidget>insideCitizenClaimWidgetStoryShellforces React to remount when toggling betweendevelopmentandproductionin Storybook controls, dropping previous environment data and re-fetching cleanly.Changes
examples/storybook/src/stories/helpers/environmentOptions.tsENVIRONMENT_OPTIONSinto a reusable helper typed asreadonly CitizenClaimWidgetEnvironment[].examples/storybook/src/stories/citizen-claim-widget/CitizenClaimWidgetShowcase.stories.tsxENVIRONMENT_OPTIONSimport.examples/storybook/src/stories/helpers/citizenClaimWidgetStories.tsxkey={environment}and wrapped in<div key={environment} data-testid={dataTestId}>to ensure clean React remounting on environment toggle; passedenvironmentthroughCustodialLocalFixtureStory.examples/storybook/src/stories/ai-credits-widget/AiCreditsWidgetThemeOverrides.stories.tsxthemes.dark.backgroundSurfaceandthemes.light.backgroundSurface; updated overridable paths copy, documenting howbackgroundSurfacecascades to other surfaces in the widget.examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsxThemedAiCreditsStoryexport with deterministic mock state anddata-testid="AiCreditsWidget-themed".examples/storybook/src/stories/ai-credits-widget/AiCreditsWidget.mdxexamples/storybook/src/stories/superfluid-campaign-widget/SuperfluidCampaignWidgetThemeOverrides.stories.tsxthemes.dark.backgroundDark/themes.light.backgroundDark; restoreddark_Button/light_Buttonbackground controls; documented cascading token behavior.examples/storybook/src/stories/helpers/superfluidCampaignWidgetStories.tsxThemedSuperfluidStoryexport mountingMockSuperfluidCampaignWidgetdirectly inside its container div.examples/storybook/src/stories/superfluid-campaign-widget/SuperfluidCampaignWidget.mdxdark_Card.backgroundtobackgroundDark.examples/storybook/src/stories/goodreserve-widget/GoodReserveWidgetThemeOverrides.stories.tsxswapShellBackgroundtobackgroundSurfaceandamountCardBackgroundtobackgroundInput; documented that token badges and confirm highlights use$backgroundSurfaceAlt, which is not wired to a control and keeps the base theme color.examples/storybook/src/stories/goodreserve-widget/GoodReserveWidget.mdxbackgroundSurface/backgroundInputtokens the widget actually uses.tests/widgets/ai-credits-widget/theme-overrides.spec.tsheroBackgroundandbuttonBackgroundin-place via the Storybook addon channel (no page reload), and asserts live computed CSS changes on the hero card (rgb(2, 132, 199)) and buy button (rgb(220, 38, 38)).tests/widgets/superfluid-campaign-widget/theme-overrides.spec.tscardBackgroundandbuttonBackgroundin-place via the Storybook addon channel, and asserts live computed CSS changes on the outer card (rgb(5, 150, 105)) and CTA button (rgb(220, 38, 38)).tests/widgets/goodreserve-widget/theme-overrides.spec.tsswapShellBackground,amountCardBackground, andsubmitButtonBackgroundin-place, and asserts live computed CSS changes on the outer shell (rgb(225, 29, 72)), amount card (rgb(5, 150, 105)), and submit button (rgb(37, 99, 235)).tests/widgets/citizen-claim-widget/showcase.spec.tsenvironment: 'development', updates the arg in-place toproduction, verifies the initial DOM node is detached (isConnected === false), and verifies intercepted outgoing RPC requests shift from development to production UBI contract addresses (0xd253a520...,0x43d72ff1...,0x22867567...).Audit Findings (#253 Showcase)
dark_Card.backgroundis not a no-op in AiCredits and GoodReserve.backgroundInput; token badges use$backgroundSurfaceAlt, and the story copy now documents that this token is not wired to a control.GoodReserveWidgetdoes not expose anenvironmentprop (tracked in [BountyPrep] Storybook: missing primitives and design system gaps #254).useCitizenClaimAdaptereffect dependencies should includeenvironmentdirectly so consumers outside Storybook do not need manual remount keys.$backgroundSurface,$backgroundSurfaceAlt,$backgroundDark,$backgroundInput) in JSX rather than referencing named Tamagui component theme targets.Verification
Local Run Results (HEAD
eed4ce4)pnpm build): Passed across workspace packages (17/17 cached / built).pnpm exec playwright test ...in 4.6s)GoodReserveWidget: Shell updatesrgb(30, 27, 75)→rgb(225, 29, 72), Amount card updatesrgb(15, 23, 42)→rgb(5, 150, 105), Submit button updatesrgb(124, 58, 237)→rgb(37, 99, 235).SuperfluidCampaignWidget: Card updatesrgb(30, 27, 75)→rgb(5, 150, 105), Action button updatesrgb(124, 58, 237)→rgb(220, 38, 38).AiCreditsWidget: Hero card updatesrgb(30, 27, 75)→rgb(2, 132, 199), Buy button updatesrgb(124, 58, 237)→rgb(220, 38, 38).CitizenClaimWidget: In-place switch confirms old DOM node detachment (isConnected === false), clean remount, and fresh RPC queries dispatched to production UBI contracts (0xd253a520...Fuse,0x43d72ff1...Celo,0x22867567...XDC).pnpm exec eslint <modified files>): Passed with 0 errors and 0 warnings.tsc --noEmit): 0 errors on modified files.Remote CI Status
Deploy Storybook/Playwright Demo): Queued awaiting maintainer approval for external fork environment deployment (pull_request_target).Evidence
tests/widgets/ai-credits-widget/test-results/acw-theme-overrides-dark.pngtests/widgets/ai-credits-widget/test-results/acw-theme-overrides-light.pngtests/widgets/ai-credits-widget/test-results/acw-theme-overrides-custom.pngtests/widgets/superfluid-campaign-widget/test-results/scw-theme-overrides-dark.pngtests/widgets/superfluid-campaign-widget/test-results/scw-theme-overrides-light.pngtests/widgets/superfluid-campaign-widget/test-results/scw-theme-overrides-custom.pngtests/widgets/goodreserve-widget/test-results/grw-theme-overrides-dark.pngtests/widgets/goodreserve-widget/test-results/grw-theme-overrides-light.pngtests/widgets/goodreserve-widget/test-results/grw-theme-overrides-custom.pngtests/widgets/citizen-claim-widget/test-results/ccw-showcase-development.pngtests/widgets/citizen-claim-widget/test-results/ccw-showcase-production.pngFollow-ups
useCitizenClaimAdapterto addenvironmentto the effect dependency arrayReserveSwapShell,SuperfluidCard) so integrators can use component sub-themes (dark_ReserveSwapShell) instead of overriding base palette tokensbackgroundSurfaceAltcontrol in the GoodReserve Theme Overrides playground (the limitation is currently documented in the story copy instead).