-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Storybook for Editable Text component
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
packages/block-editor/src/components/editable-text/stories/index.story.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!', | ||
}, | ||
}; |