Skip to content

Commit

Permalink
Add Storybook for Editable Text component
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishit30G committed Dec 26, 2024
1 parent 4ad26e1 commit 0635843
Showing 1 changed file with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Internal dependencies
*/
import EditableText from '../';

const meta = {
component: EditableText,
title: 'BlockEditor/EditableText',
parameters: {
docs: {
description: {
component:
'The `EditableText` component allows to display a text that can be edited by the user.',
},
canvas: { sourceState: 'shown' },
},
},
argTypes: {
value: {
control: 'text',
description: 'The value of the editable text.',
table: {
type: { summary: 'string' },
},
},
onChange: {
action: 'onChange',
control: { type: null },
description:
'Called when a selection is made. If `null`, _Default_ is selected.',
table: {
type: { summary: 'function' },
},
},
className: {
control: 'text',
description: 'The class name of the editable text.',
table: {
type: { summary: 'string' },
},
},
},
};

export default meta;

export const Default = {
render: function Template( props ) {
return (
<EditableText
className={ props.className }
value={ props.value }
onChange={ props.onChange }
/>
);
},
args: {
value: 'Hello World!',
},
};

0 comments on commit 0635843

Please sign in to comment.