-
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
- Loading branch information
1 parent
9b0e2d9
commit 3c6c2e1
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
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,62 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockAlignmentMatrixControl from '../'; | ||
|
||
export default { | ||
title: 'BlockEditor/BlockAlignmentMatrixControl', | ||
component: BlockAlignmentMatrixControl, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
argTypes: { | ||
label: { | ||
control: 'text', | ||
defaultValue: 'Change matrix alignment', | ||
description: 'Label for the control.', | ||
}, | ||
onChange: { | ||
action: 'onChange', | ||
description: 'Function called when the value changes.', | ||
}, | ||
isDisabled: { | ||
control: 'boolean', | ||
defaultValue: false, | ||
description: 'Whether the control is disabled.', | ||
}, | ||
value: { | ||
description: 'The current alignment value.', | ||
}, | ||
}, | ||
}; | ||
|
||
const Template = ( { onChange, ...args } ) => { | ||
const [ value, setValue ] = useState( 'center center' ); | ||
|
||
return ( | ||
<BlockAlignmentMatrixControl | ||
{ ...args } | ||
value={ value } | ||
onChange={ ( ...changeArgs ) => { | ||
onChange( ...changeArgs ); | ||
setValue( ...changeArgs ); | ||
} } | ||
/> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind( {} ); | ||
Default.args = { | ||
label: 'Change matrix alignment', | ||
}; | ||
|
||
export const Disabled = Template.bind( {} ); | ||
Disabled.args = { | ||
label: 'Disabled Alignment Control', | ||
isDisabled: true, | ||
}; |