Skip to content

Commit

Permalink
Storybook: Add WritingModeControl story (#67343)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 207dfe3 commit 53ed803
Showing 1 changed file with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import WritingModeControl from '../';

const meta = {
title: 'BlockEditor/WritingModeControl',
component: WritingModeControl,
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description: {
component: 'Control to facilitate writing mode selections.',
},
},
},
argTypes: {
value: {
control: { type: null },
description: 'Currently selected writing mode.',
},
className: {
control: 'text',
description: 'Class name to add to the control.',
},
onChange: {
action: 'onChange',
control: { type: null },
description: 'Handles change in the writing mode selection.',
},
},
};

export default meta;

export const Default = {
render: function Template( { onChange, ...args } ) {
const [ value, setValue ] = useState();

return (
<WritingModeControl
{ ...args }
onChange={ ( ...changeArgs ) => {
onChange( ...changeArgs );
setValue( ...changeArgs );
} }
value={ value }
/>
);
},
};

0 comments on commit 53ed803

Please sign in to comment.