Add storybook to repo#29
Open
tinydinosaurs wants to merge 4 commits into
Open
Conversation
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.
Adds an integrated Storybook instance directly inside
vsc-ui-reactso component documentation lives alongside source code, eliminating the need for the separatevsc-ui-react-storybookrepo.What's included
Storybook infrastructure (
.storybook/)@storybook/react-viteframework@storybook/addon-a11yand@storybook/addon-docsaddonsthemes.ts)DocsContainer.tsx)manager.ts)preview-head.html)Component stories (
src/components/<Name>/<Name>.stories.tsx)tags: ['autodocs']for automatic docs page generationparameters.docs.description.componentDesign language pages (
src/stories/)Composed example (
src/stories/SettingsPanel.stories.tsx)Story helpers (
src/stories/helpers/)helpers.tsx— shared layout components (Section,Row,Inline) used across all storiesdesign-language-helpers.tsx— helper components for Typography and Colors pagesBuild & packaging
tsconfig.build.jsonexclude.storybook/excluded from npm package via inclusion-onlyfilesfield inpackage.jsonstorybook-static/anddebug-storybook.logadded to.gitignorenpm run storybook(dev) andnpm run build-storybook(static) scriptsButton component refinements
VscButtonPropsrefactored to curatedPickpattern with JSDoc on each propuseButtonStyles.ts— icon colors now handled natively by Fluent's token system via theme composition inthemes.tsButton as the reference implementation
The Button component received the most attention and is the best example of what this POC is illustrating. When reviewing, start there.
What we did to Button specifically:
The button previously accepted every possible HTML and Fluent UI property, which meant autodocs couldn't generate a useful props table — it would have been hundreds of items long. We refactored
VscButtonPropsto declare exactly which properties the button supports:What this looks like in Storybook:
Why this matters:
The same pattern can be applied to the other components (Input, Dropdown, etc.) once the team is happy with the approach.
Docs updates
.storybook/and co-located stories, added Storybook section with story conventions, theming architecture, and CSS override rulesAbout the MDX files in
src/stories/docs/The
docs/folder contains three MDX files (Colors.mdx,Typography.mdx,Overview.mdx) that are intentionally kept as reference examples of an alternative approach to documentation.MDX vs. stories for documentation pages:
.mdx).stories.tsx)The Typography and Colors pages exist as both
.stories.tsxand.mdxversions. The.stories.tsxversions are what Storybook renders — the.mdxfiles are kept for comparison. A team could choose either approach depending on whether they prefer markdown authoring or want everything in TypeScript.How to test
cd vsc-ui-react npm install npm run storybookThen toggle the dark/light switch in the toolbar to verify theme switching works across all views.