-
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.
Storybook: Add PlainText Storybook stories (#67341)
* Storybook: Add PlainText Storybook stories - Add Default, LongText, and WithClassName stories - Configure meta for PlainText component * Refactor: `PlainText` stories and removed useEffect * Refactor: Remove comment from story * Storybook: improve `PlainText` JSDoc and storybook descriptions - Enhance prop descriptions - Fix import order in storybook. * Storybook: Unify value and onChange prop descriptions Co-authored-by: SainathPoojary <[email protected]> Co-authored-by: t-hamano <[email protected]>
- Loading branch information
1 parent
dea955c
commit ad073b0
Showing
4 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
75 changes: 75 additions & 0 deletions
75
packages/block-editor/src/components/plain-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,75 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PlainText from '..'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/PlainText', | ||
component: PlainText, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'PlainText renders an auto-growing textarea that allows users to enter any textual content.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
value: { | ||
control: { | ||
type: null, | ||
}, | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
description: 'String value of the textarea.', | ||
}, | ||
onChange: { | ||
action: 'onChange', | ||
control: { | ||
type: null, | ||
}, | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
description: 'Function called when the text value changes.', | ||
}, | ||
className: { | ||
control: 'text', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
description: 'Additional class name for the PlainText.', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
render: function Template( { onChange, ...args } ) { | ||
const [ value, setValue ] = useState(); | ||
return ( | ||
<PlainText | ||
{ ...args } | ||
onChange={ ( ...changeArgs ) => { | ||
onChange( ...changeArgs ); | ||
setValue( ...changeArgs ); | ||
} } | ||
value={ value } | ||
/> | ||
); | ||
}, | ||
}; |
ad073b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in ad073b0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12424678327
📝 Reported issues:
/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js
/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js