Skip to content

Commit

Permalink
Storybook: Add BlockAlignmentMatrixControl Stories
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukhendu2002 committed Nov 26, 2024
1 parent 9b0e2d9 commit 3c6c2e1
Showing 1 changed file with 62 additions and 0 deletions.
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,
};

0 comments on commit 3c6c2e1

Please sign in to comment.