Storybook: Add stories for BlockAlignmentControl and BlockAlignmentToolbar components#67233
Storybook: Add stories for BlockAlignmentControl and BlockAlignmentToolbar components#67233
Conversation
|
Size Change: 0 B Total Size: 1.84 MB ℹ️ View Unchanged
|
…-alignment-control-stories
|
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. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
While reviewing this PR, I noticed that the documentation for this component itself is insufficient. Not all props that are actually supported are documented.
Specifically, controls and isCollapsed. As for the isToolbar prop, it is determined internally depending on whether you use BlockAlignmentControl or BlockAlignmentToolbar, so there is no need to document it.
Could you investigate the behavior of these two and reflect it in the README and Storybook?
| argTypes: { | ||
| value: { | ||
| control: { type: null }, | ||
| defaultValue: 'undefined', |
There was a problem hiding this comment.
defaultValue is deprecated so let's remove it. It should not affect behavior.
| argTypes: { | ||
| value: { | ||
| control: { type: null }, | ||
| defaultValue: 'undefined', |
There was a problem hiding this comment.
defaultValue is deprecated so let's remove it. It should not affect behavior.
...block-editor/src/components/block-alignment-control/stories/block-alignment-toolbar.story.js
Show resolved
Hide resolved
t-hamano
left a comment
There was a problem hiding this comment.
Sorry for the late reply.
To make stories more understandable, it's a good idea to define types and default values for the props. You can define them in the following fields. Take a look at other components:
- Types:
meta.argTypes.{propName}.table.type.summary - Default value:
meta.argTypes.{propName}.table.defaultValue.summary
| - **Default:** | ||
|
|
||
| ```js | ||
| [ 'none', 'left', 'center', 'right', 'wide', 'full' ]; | ||
| ``` |
There was a problem hiding this comment.
| - **Default:** | |
| ```js | |
| [ 'none', 'left', 'center', 'right', 'wide', 'full' ]; | |
| ``` | |
| - **Default:** [ `none`, `left`, `center`, `right`, `wide`, `full` ] |
| /** | ||
| * The `BlockAlignmentToolbar` component is used to render block alignment options in the editor. The different alignment options it provides are `left`, `center`, `right`, `wide` and `full`. | ||
| */ |
There was a problem hiding this comment.
Let's move this comment to meta.parameters.docs.description.component field.
| /** | ||
| * The `BlockAlignmentControl` component is used to render block alignment options in the editor. The different alignment options it provides are `left`, `center`, `right`, `wide` and `full`. | ||
| * | ||
| * If you want to use the block alignment control in a toolbar, you should use the `BlockAlignmentToolbar` component instead. | ||
| */ |
There was a problem hiding this comment.
Let's move this comment to meta.parameters.docs.description.component field.
| description: 'An array of available alignment controls.', | ||
| }, | ||
| isCollapsed: { | ||
| control: { type: null }, |
There was a problem hiding this comment.
| control: { type: null }, | |
| control: 'boolean', |
Let's make this parameter controllable.
aef25885501c2a0fed0ba5ef131b7d98.mp4
…add/block-alignment-control-stories
Part of #67165
What?
This PR will add stories for
BlockAlignmentControlandBlockAlignmentToolbarcomponents in the StorybookWhy?
Most of Block Editor components don't have stories.
Testing Instructions
npm run storybook:devBlockAlignmentControlandBlockAlignmentControlstories.Screenshots or screencast
BlockEditor-BlockAlignmentControl---Docs-.-Storybook.webm