-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Storybook: Add webpack loader for easier story descriptions #39165
Conversation
Size Change: 0 B Total Size: 1.15 MB ℹ️ View Unchanged
|
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.
Overall it looks good to me! 🚀
We'll just need to keep an eye for:
- Any changes in the Storybook APIs that may break this plugin
- Any changes in the Storybook APIs that may make this feature native
test: /\/stories\/.+\.js$/, | ||
// Currently does not work with our tsx stories | ||
// See https://github.com/storybookjs/storybook/issues/17275 | ||
test: /\/stories\/.+\.(j|t)sx?$/, |
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.
I've tried adding a Story description to Divider
(a tsx
story) and it seemed to work — what should we expect to be broken?
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.
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.
Yeah, if we show code snippets in the docs it's not really necessary
Follow-up to #38727 (comment)
Description
This adds a simple webpack loader (based on
story-description-loader
) that will allow us to write story descriptions more easily as doc comments, rather than as a deep parameter:Before
After
The deep parameter path is way too hard to remember, so I imagine people (including me) will have to search for a code snippet every time they want to add a description. The doc comment way is much more intuitive for everyone, and will possibly become a built-in Storybook feature. Given that we will be adding a lot more story descriptions as part of our doc improvement efforts, I think this loader will be a huge help.
Additional benefits
Testing Instructions
npm run storybook:dev
FontSizePicker
and their descriptions.Types of changes
Storybook only.
Checklist:
*.native.js
files for terms that need renaming or removal).