-
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 WritingModeControl story #67343
Storybook: Add WritingModeControl story #67343
Conversation
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!
In order to move this PR forward, I would like to suggest two points that I think are particularly important.
1 - Only one story is needed: I think the only difference between the Default and Vertical stories is the default value. In this case, I think an additional story (Vertical) is unnecessary.
2 - Don't make the value
prop controllable: In the current implementation, nothing happens when you press the component's button after changing the value prop.
b67d787f2e6b0d17f55218fbc36fe20e.mp4
How about implementing it in control mode as follows?
export const Default = {
render: function Template( { onChange, ...args } ) {
const [ value, setValue ] = useState();
return (
<WritingModeControl
{ ...args }
onChange={ ( ...changeArgs ) => {
onChange( ...changeArgs );
setValue( ...changeArgs );
} }
value={ value }
/>
);
},
};
packages/block-editor/src/components/writing-mode-control/stories/index.story.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/writing-mode-control/stories/index.story.js
Show resolved
Hide resolved
Hi @t-hamano, Thanks for the detailed feedback! I’ve updated the story:
Please let me know if there’s anything else that needs adjustment! |
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 update! Overall it looks good, but I'd like to suggest two additional illustrations at the end.
packages/block-editor/src/components/writing-mode-control/stories/index.story.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/writing-mode-control/stories/index.story.js
Outdated
Show resolved
Hide resolved
Hi @t-hamano, Thanks for the feedback! I’ve addressed both points. |
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.
LGTM! Works as expected 👍
8a3b9f256639d65386dad23e24632256.mp4
* Storybook: Add WritingModeControl story * Enhance WritingModeControl usability and simplify structure * Simplify WritingModeControl story implementation Co-authored-by: Sukhendu2002 <[email protected]> Co-authored-by: t-hamano <[email protected]>
Part of #67165
What?
This PR will add stories for WritingModeControl component in the Storybook.
Testing Instructions
Screenshots or screencast
Screen.Recording.2024-11-27.at.4.10.10.PM.mov