-
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 stories for BlockAlignmentControl and BlockAlignmentToolbar components #67233
base: trunk
Are you sure you want to change the base?
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. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
control: { type: null }, | |
control: 'boolean', |
Let's make this parameter controllable.
Part of #67165
What?
This PR will add stories for
BlockAlignmentControl
andBlockAlignmentToolbar
components in the StorybookWhy?
Most of Block Editor components don't have stories.
Testing Instructions
npm run storybook:dev
BlockAlignmentControl
andBlockAlignmentControl
stories.Screenshots or screencast
BlockEditor-BlockAlignmentControl---Docs-.-Storybook.webm