UI: improve component code readability in Storybook - #80129
Conversation
|
Size Change: 0 B Total Size: 7.72 MB |
| </> | ||
| ), | ||
| }, | ||
| render: ( {} ) => ( |
There was a problem hiding this comment.
Without {} here we'd get render() => ( ) visible in the code example. Some kind of known Storybook quirk to pass either {} or _args to fix it. 🤷
e791b83 to
0cfd19d
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in ad0d750. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29123316066
|
This defeats the point of using Storybook controls and |
|
Out of curiosity, would it work to pass |
Refactor stories to use explicit render functions with direct child
composition instead of args.children fragments, and use render: ( {} ) =>
so Show code displays clean JSX snippets.
ad0d750 to
e079457
Compare
Seems to do the trick as well! It'll require adding Moved that solution to another PR: |
We would still continue using E.g.
|
|
With #80352 merged, can we close this PR? |
Follow-up to #77382 (comment)
Pairs with #80132 which adds
displayNames.What?
Avoids
<React.Fragment>appearing in code examplesWhy?
Cleaner code previews and copy-paste for docs consumers.
How?
Switch from
args: { children: () }to replacing rendering fully withrenderprop.Passes dummy
{}just to work around a known Storybook quirk: otherwise Storybook will show:render: () => ()as part of the code snippet.Testing Instructions
Run
npm run storybook:devSmoke test different stories and code snippets.
Testing Instructions for Keyboard
Screenshots or screencast
Before
After
When combined with #80132:
Use of AI Tools
yes