Skip to content

Commit

Permalink
Storybook: Update story with component API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshupathak95 committed Dec 27, 2024
1 parent 7ccd739 commit 6bef077
Showing 1 changed file with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ const meta = {
argTypes: {
value: {
control: { type: null },
description: 'Text content to make editable.',
description: 'String to make editable.',
table: {
type: { summary: 'string' },
},
},
onChange: {
action: 'onChange',
control: { type: null },
description: 'Called when the text content changes.',
description: 'Called when the value changes.',
table: {
type: { summary: 'function' },
},
Expand All @@ -53,19 +53,47 @@ const meta = {
},
disableLineBreaks: {
control: 'boolean',
description: 'Prevents insertion of line breaks on Enter.',
description:
"Text won't insert line breaks on Enter if set to true.",
table: {
type: { summary: 'boolean' },
},
},
onReplace: {
action: 'onReplace',
control: { type: null },
description:
'Called when the Text instance can be replaced with the given blocks.',
table: {
type: { summary: 'function' },
},
},
onMerge: {
action: 'onMerge',
control: { type: null },
description:
'Called when blocks can be merged. Forward is true when merging with the next block, false when merging with the previous block.',
table: {
type: { summary: 'function' },
},
},
onRemove: {
action: 'onRemove',
control: { type: null },
description:
'Called when the block can be removed. Forward is true when the selection is expected to move to the next block, false to the previous block.',
table: {
type: { summary: 'function' },
},
},
},
};

export default meta;

export const Default = {
render: function Template( { onChange, ...args } ) {
const [ value, setValue ] = useState( '' );
const [ value, setValue ] = useState();
return (
<EditableText
{ ...args }
Expand All @@ -74,7 +102,7 @@ export const Default = {
onChange( ...changeArgs );
setValue( ...changeArgs );
} }
placeholder="Type some text..."
tagName={ args.tagName || 'div' }
/>
);
},
Expand Down

0 comments on commit 6bef077

Please sign in to comment.