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. |
t-hamano
left a comment
There was a problem hiding this comment.
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
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! |
t-hamano
left a comment
There was a problem hiding this comment.
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. |
t-hamano
left a comment
There was a problem hiding this comment.
LGTM! Works as expected 👍
8a3b9f256639d65386dad23e24632256.mp4
* Storybook: Add WritingModeControl story * Enhance WritingModeControl usability and simplify structure * Simplify WritingModeControl story implementation Co-authored-by: Sukhendu2002 <sukhendu2002@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
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