-
Notifications
You must be signed in to change notification settings - Fork 12
Storybook polish: interactive theming controls for widgets (#64) #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Godbrand0
wants to merge
12
commits into
GoodDollar:main
Choose a base branch
from
Godbrand0:feat/storybook-controls-polish
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
569f7ac
feat(storybook): wire defaultTheme/brandPreset controls into widget s…
Godbrand0 17b8e65
docs(storybook): add integration snippets to widget MDX guides
Godbrand0 6cbf8df
fix(storybook): Stepper Controllable story ignored activeStepId control
Godbrand0 1549925
fix(storybook): brandPreset control was a no-op for StreamingWidget
Godbrand0 28547d2
docs(storybook): clarify Default stories don't respond to Controls
Godbrand0 7d00642
fix(storybook): themeOverrides dropped on StreamingWidget's no-wallet…
Godbrand0 73cb7e2
feat(storybook): extend defaultTheme/brandPreset controls to QA fixtu…
Godbrand0 d812285
fix(storybook): add light_* brand preset overrides, fix ClaimActionGl…
Godbrand0 bc797f4
fix(storybook): remove dead goodWidgetProvider parameter blocks
Godbrand0 a2bb33c
feat(storybook): add StreamingWidget advanced-overrides playground, f…
Godbrand0 b296507
feat(storybook): replicate theme-overrides playground to ClaimWidget …
Godbrand0 4c77ccf
fix(storybook): wire up docs pages and disableSaveFromUI missed in pr…
Godbrand0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
30 changes: 27 additions & 3 deletions
30
examples/storybook/src/stories/citizen-claim-widget/CitizenClaimWidgetQA.stories.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,41 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react' | ||
| import { CitizenClaimWidget } from '@goodwidget/citizen-claim-widget' | ||
| import { CustodialLocalFixtureStory } from '../helpers/citizenClaimWidgetStories' | ||
| import { BRAND_PRESET_OPTIONS, brandPresetOverrides, type BrandPreset } from '../helpers/themeOverridePresets' | ||
|
|
||
| const meta: Meta<typeof CitizenClaimWidget> = { | ||
| interface CitizenClaimWidgetQAArgs { | ||
| defaultTheme: 'light' | 'dark' | ||
| brandPreset: BrandPreset | ||
| } | ||
|
|
||
| const meta: Meta<CitizenClaimWidgetQAArgs> = { | ||
| title: 'QA/CitizenClaimWidget/Runtime Fixtures', | ||
| component: CitizenClaimWidget, | ||
| tags: ['autodocs', 'qa'], | ||
| parameters: { layout: 'padded' }, | ||
| argTypes: { | ||
| defaultTheme: { | ||
| control: 'radio', | ||
| options: ['dark', 'light'], | ||
| description: 'Base theme applied via the widget’s own defaultTheme prop.', | ||
| }, | ||
| brandPreset: { | ||
| control: 'select', | ||
| options: BRAND_PRESET_OPTIONS, | ||
| description: 'Sample host-branding themeOverrides preset.', | ||
| }, | ||
| }, | ||
| args: { | ||
| defaultTheme: 'dark', | ||
| brandPreset: 'None', | ||
| }, | ||
| } | ||
|
|
||
| export default meta | ||
| type Story = StoryObj<typeof meta> | ||
| type Story = StoryObj<CitizenClaimWidgetQAArgs> | ||
|
|
||
| export const CustodialLocalFixture: Story = { | ||
| render: () => <CustodialLocalFixtureStory />, | ||
| render: ({ defaultTheme, brandPreset }) => ( | ||
| <CustodialLocalFixtureStory defaultTheme={defaultTheme} themeOverrides={brandPresetOverrides(brandPreset)} /> | ||
| ), | ||
| } |
30 changes: 27 additions & 3 deletions
30
examples/storybook/src/stories/citizen-claim-widget/CitizenClaimWidgetShowcase.stories.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,41 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react' | ||
| import { CitizenClaimWidget } from '@goodwidget/citizen-claim-widget' | ||
| import { InjectedWalletStory } from '../helpers/citizenClaimWidgetStories' | ||
| import { BRAND_PRESET_OPTIONS, brandPresetOverrides, type BrandPreset } from '../helpers/themeOverridePresets' | ||
|
|
||
| const meta: Meta<typeof CitizenClaimWidget> = { | ||
| interface CitizenClaimWidgetStoryArgs { | ||
| defaultTheme: 'light' | 'dark' | ||
| brandPreset: BrandPreset | ||
| } | ||
|
|
||
| const meta: Meta<CitizenClaimWidgetStoryArgs> = { | ||
| title: 'Widgets/CitizenClaimWidget/Showcase', | ||
| component: CitizenClaimWidget, | ||
| tags: ['integrator', 'manual', 'showcase'], | ||
| parameters: { layout: 'padded' }, | ||
| argTypes: { | ||
| defaultTheme: { | ||
| control: 'radio', | ||
| options: ['dark', 'light'], | ||
| description: 'Base theme applied via the widget’s own defaultTheme prop.', | ||
| }, | ||
| brandPreset: { | ||
| control: 'select', | ||
| options: BRAND_PRESET_OPTIONS, | ||
| description: 'Sample host-branding themeOverrides preset.', | ||
| }, | ||
| }, | ||
| args: { | ||
| defaultTheme: 'dark', | ||
| brandPreset: 'None', | ||
| }, | ||
| } | ||
|
|
||
| export default meta | ||
| type Story = StoryObj<typeof meta> | ||
| type Story = StoryObj<CitizenClaimWidgetStoryArgs> | ||
|
|
||
| export const InjectedWallet: Story = { | ||
| render: () => <InjectedWalletStory />, | ||
| render: ({ defaultTheme, brandPreset }) => ( | ||
| <InjectedWalletStory defaultTheme={defaultTheme} themeOverrides={brandPresetOverrides(brandPreset)} /> | ||
| ), | ||
| } |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goodWidgetProvider here sits at the top level of meta, but the decorator in .storybook/preview.tsx reads context.parameters.goodWidgetProvider, so disableProvider: true, useShell: false never actually applies to these stories. Moving it inside parameters (as every other story file does) makes it functional and also clears the TS2353 error on this file.