Repository navigation
Conversation
Replace example components in stories with inline renders, shared meta renders, args, and decorators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@skillsoft/eslint-plugin-gamut
@skillsoft/gamut
@skillsoft/gamut-agent-tools
@skillsoft/gamut-codemods
@skillsoft/gamut-icons
@skillsoft/gamut-illustrations
@skillsoft/gamut-patterns
@skillsoft/gamut-styles
@skillsoft/gamut-tests
@skillsoft/variance
commit: |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the Storybook updates that expose component markup in Show code.
No open issues 🎉
What changed in this PR
This PR updates Gamut’s Storybook examples so Show code exposes component markup instead of local example-component tags. Changes are limited to stories, supporting utilities, and an empty changeset.
Changes:
- Inline example markup and move hook state into named render functions.
- Share renders where appropriate and move layout-only wrappers into decorators.
- Replace Modal placeholder components with JSX helpers and remove unused story utilities.
| File | Description |
|---|---|
packages/gamut/src/Tips/PreviewTip/PreviewTip.stories.tsx |
Inline examples and extract a centering decorator. |
packages/gamut/src/Popover/Popover.stories.tsx |
Share trigger markup through meta.render and use layout decorators. |
packages/gamut/src/Pagination/Pagination.stories.tsx |
Inline the controlled pagination example. |
packages/gamut/src/Modals/Modal.stories.tsx |
Replace placeholder components with JSX helpers. |
packages/gamut/src/List/ListRow.stories.tsx |
Inline expandable rows and share expansion state logic. |
packages/gamut/src/List/ListCol.stories.tsx |
Inline scrolling rows and decorate the constrained-width example. |
packages/gamut/src/List/List.stories.tsx |
Inline scroll-update and container-query examples. |
packages/gamut/src/Form/inputs/SelectDropdown/SelectDropdown.stories.tsx |
Move hooks and markup into seven named renders. |
packages/gamut/src/Form/inputs/Radio/Radio.stories.tsx |
Inline the controlled radio-group example. |
packages/gamut/src/Form/inputs/Checkbox/Checkbox.stories.tsx |
Inline controlled and nested checkbox examples. |
packages/gamut/src/Disclosure/Disclosure.stories.tsx |
Replace background wrappers with a decorator and story args. |
packages/gamut/src/DataList/testUtils.tsx |
Remove the replaced table factory and container-query helper. |
packages/gamut/src/DataList/DataTable.stories.tsx |
Share the local-query render and inline container-query markup. |
packages/gamut/src/DataList/DataList.stories.tsx |
Inline the full interactive list and container-query examples. |
packages/gamut/src/ConnectedForm/ConnectedForm.stories.tsx |
Share four-field form markup and inline specialized examples. |
packages/gamut/src/Anchor/Anchor.stories.tsx |
Inline the variants grid and reuse its render for icon variants. |
.changeset/orange-monkeys-follow.md |
Add an empty changeset for the documentation-only update. |
Review effort: Balanced
This branch has not been 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.
Overview
Many stories rendered an example component defined in the stories file (
<PopoverExample />,<ExpandableButtonClickRow />,<PlainConnectedFields />, and so on). For those stories, Show code displayed only that component's name, so readers never saw the Gamut markup they came to copy. This PR inlines those examples, following the pattern Dialog already uses.How Show code picks its source
argsgets a dynamic snippet built from the JSX it returns.<FooExample />shows up as a single tag and hides everything inside it.What replaced the example components
render: function ControlledPagination(args) {...}) where a story needs hook state. The markup is inline in the render.meta.renderwhere most stories render the same thing. Each story sets only its ownargs. Used in Popover (PopoverWithTrigger) and ConnectedForm (the four-field form behind the behavior stories).renderLocalQueryTablein DataTable, andrenderExpandableRowsin ListRow, where aclickableRowsarg switches betweenExpandControland a clickable row with a chevron.gridContentPlaceholder('300px')andcodeCelebrationImage). These are functions and constants, not components, so the dynamic snippet shows theFlexBox/Boxmarkup instead of a component name.Files
DataList/testUtils.tsx(removedcreateDemoTableandDisableContainerQueryExample, which nothing else used).Left alone on purpose
ComposedDatePickerLayoutand the ConnectedFormInputs helpers need context from a provider or hook.RowMenuis a cell renderer passed to a column, not story markup.ButtonScaleis a matrix built in a loop.ThreeTabsis the story's render itself (render: ThreeTabs), so Show code already shows its code.Known limitations / notes for reviewers
BeakCenteredno longer setsp={0}, so it now gets the same 16px padding as the other Popover stories.ExpandableButtonandExpandableClickableRowshow aclickableRowscontrol in the Controls panel. It's a story-only arg, removed before props reachList.rendergets the four-field form frommeta.render.OnChangeValidationkeeps its own render, because its submit button disables itself when the form is invalid. Putting that in the shared render would disable the button in the stories that click submit with empty fields to trigger errors.expandedNamesarray in the story instead of auseStateper row. Several rows can still be open at once.PR Checklist
Testing Instructions
Popover,ListRow/ListCol,ConnectedFormGroup,DataTable), not a local*Example/*Templatecomponent.yarn test:storiesand confirm the story tests pass.PR Links and Envs
🤖 Generated with Claude Code