-
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 BlockAlignmentMatrixControl Stories and update README (#…
…68007) * Storybook: Add BlockAlignmentMatrixControl Stories and update README * Fix defaultValue summary quotes in BlockAlignmentMatrixControl storie * Add JSDoc for BlockAlignmentMatrixControl * Improve JSDoc block indentation * Update JSDoc block indentation * Improve BlockAlignmentMatrixControl story Co-authored-by: Sukhendu2002 <[email protected]> Co-authored-by: t-hamano <[email protected]>
- Loading branch information
1 parent
030c680
commit 2d974f2
Showing
3 changed files
with
138 additions
and
6 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
78 changes: 78 additions & 0 deletions
78
packages/block-editor/src/components/block-alignment-matrix-control/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,78 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockAlignmentMatrixControl from '../'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/BlockAlignmentMatrixControl', | ||
component: BlockAlignmentMatrixControl, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'Renders a control for selecting block alignment using a matrix of alignment options.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
label: { | ||
control: 'text', | ||
table: { | ||
type: { summary: 'string' }, | ||
defaultValue: { summary: "'Change matrix alignment'" }, | ||
}, | ||
description: 'Label for the control.', | ||
}, | ||
onChange: { | ||
action: 'onChange', | ||
control: { type: null }, | ||
table: { | ||
type: { summary: 'function' }, | ||
defaultValue: { summary: '() => {}' }, | ||
}, | ||
description: | ||
"Function to execute upon a user's change of the matrix state.", | ||
}, | ||
isDisabled: { | ||
control: 'boolean', | ||
table: { | ||
type: { summary: 'boolean' }, | ||
defaultValue: { summary: 'false' }, | ||
}, | ||
description: 'Whether the control should be disabled.', | ||
}, | ||
value: { | ||
control: { type: null }, | ||
table: { | ||
type: { summary: 'string' }, | ||
defaultValue: { summary: "'center'" }, | ||
}, | ||
description: 'Content alignment location.', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
render: function Template( { onChange, ...args } ) { | ||
const [ value, setValue ] = useState(); | ||
|
||
return ( | ||
<BlockAlignmentMatrixControl | ||
{ ...args } | ||
value={ value } | ||
onChange={ ( ...changeArgs ) => { | ||
onChange( ...changeArgs ); | ||
setValue( ...changeArgs ); | ||
} } | ||
/> | ||
); | ||
}, | ||
}; |
2d974f2
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 2d974f2.
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/12407494279
📝 Reported issues:
/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js
/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js