docs(swc): convert 2nd-gen component story JSDoc to per-component MDX#6349
docs(swc): convert 2nd-gen component story JSDoc to per-component MDX#6349caseyisonit wants to merge 14 commits into
Conversation
Introduce two genre-aware Storybook doc blocks that own the standard top
and bottom of every per-unit docs page. Components, patterns, and
controllers compose a page as:
<Meta of={Stories} />
<DocsHeader />
...prose + Canvas references...
<DocsFooter />
DocsHeader renders Title, StatusBadge, Subtitle, Description, the overview
story, and getting-started instructions. DocsFooter renders the API
section (skipping ApiTable for tag='controller'), Primary, Controls,
optional custom API stories, and the feedback link.
Rewrite DocumentTemplate.mdx in terms of the new blocks so the
template-driven docs page and the forthcoming per-unit MDX pages share
the exact same chrome with no duplicate boilerplate to drift.
Also adds research.md documenting the broader conversion plan.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
….mdx Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Auto-generated by update-nav.js for newly added migration analysis docs (action-button, button-group, close-button, grid, infield-button, link migration plan, popover migration plan, changelog strategy guide). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
There was a problem hiding this comment.
This and the DocsHeader blocks will be refined in a future PR but this reflects the current patterns that are consistent across all docs so far. Heavily based on DocumentTemplate.
There was a problem hiding this comment.
Auto generated from merges to main that werent picked up before
| ## Behaviors | ||
|
|
||
| ### Text Wrapping | ||
|
|
||
| When a badge's label is too long for the available horizontal space, it wraps to form multiple lines. | ||
| Text wrapping can be controlled by applying a `max-inline-size` constraint to the badge. | ||
|
|
||
| This ensures badges remain readable even with longer status messages or category names. | ||
|
|
||
| <Canvas of={BadgeStories.TextWrapping} /> | ||
|
|
||
| ### Inline | ||
|
|
||
| Badges flow naturally within prose text to annotate inline content such as headings, labels, list items, or table cells. | ||
|
|
||
| Because `<swc-badge>` renders as `inline-flex`, it participates in the normal text flow without any extra wrapper styling required. Use small (`s`) badges in most inline contexts to avoid disrupting line height. | ||
|
|
||
| <Canvas of={BadgeStories.Inline} /> |
There was a problem hiding this comment.
You will notice the order some sections (behaviors) varies from production, this is because its honoring the authoring order whereas production was following alpha order when rendering because we didnt use the section-order parameter. this is an acceptable difference as long as the content for each story is still accurate.
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Description
Move long-form documentation that previously lived as JSDoc comments above story exports in
.stories.tsfiles into per-component MDX files at the component root. Each MDX file uses Storybook doc blocks (<Meta of={...} />,<Canvas of={Story} />) to render stories explicitly, and becomes the authoritative Docs page for that component, replacing the template-driven page generated byDocumentTemplate.mdxon a per-component basis.Scope (this PR): 9 components + 2 internal stories + shared infrastructure.
badge,avatar,color-loupe,divider,progress-circle,status-light,typography,illustrated-message,button,tabsasset(.internal.mdx),icon(.internal.mdx)DocsHeaderandDocsFooter(in2nd-gen/packages/swc/.storybook/blocks/) own all the standard chrome at the top and bottom of every docs page, so the template-driven page and per-component MDX share the exact same surface with no duplicate boilerplate.DocumentTemplate.mdxnow composes itself from the new blocks; components without a per-component MDX continue to render through it unchanged.preview.tsregistrations for several new migration-analysis contributor docs (action-button, button-group, close-button, grid, infield-button, link, popover, changelog strategy) — picked up fromupdate-nav.js.Motivation and context
Story-level JSDoc was the only mechanism for long-form prose attached to each story, which forced documentation-only stories (
tags: ['description-only']) andsection-orderparameters to influence rendering order. Moving to MDX:description-onlyanti-pattern: prose-only sections live in MDX without needing a fake story to hang JSDoc on.section-orderworkarounds: ordering is explicit in MDX.<Canvas of={Story} />references that survive lint and refactors.DocsHeader/DocsFootershell (out of scope for this PR but enabled by it).The new MDX structure mirrors the section order of
DocumentTemplate.mdxso local builds match production rendering: Anatomy → Upcoming features → Usage → Options → States → Behaviors → Accessibility → API → Feedback.Related issue(s)
Screenshots (if appropriate)
Visual parity verified by spot-checking badge, status-light, and tabs Docs pages against the template-driven rendering.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Per-component Docs pages render via MDX
yarn storybookin2nd-gen/packages/swc//docs/components-badge--docs,components-avatar--docs,components-color-loupe--docs,components-divider--docs,components-progress-circle--docs,components-status-light--docs,components-typography--docs,components-illustrated-message--docs,components-button--docs,components-tabs--docsUnconverted components still render through DocumentTemplate
/docs/components-accordion--docs(no MDX file exists)DocumentTemplate.mdx, indistinguishable from the previous template output.Internal Docs pages render
/docs/components-asset--docsand/docs/components-icon--docs.internal.mdx. Confirm they are excluded from production builds (rerun withNODE_ENV=production).Story title and section order match production
### Titleheadings (Title Case for PascalCase exports withoutstoryName, exact string for those withstoryName) appear in the same order and with the same casing as production.Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (required — document steps below)
/docs/components-button--docs), press Tab through the page.<Canvas>regions.Screen reader (required — document steps below)
hideTitle=false), h4/h5 (subsections within JSDoc-derived prose).