Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook: Add BorderRadiusControl story #67383

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import BorderRadiusControl from '../';

const meta = {
title: 'BlockEditor/BorderRadiusControl',
component: BorderRadiusControl,
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description: {
component: 'Control to display border radius options.',
},
},
},
argTypes: {
values: {
control: 'object',
description: 'Border radius values.',
table: {
type: { summary: 'object' },
},
},
onChange: {
action: 'onChange',
control: { type: null },
table: {
type: { summary: 'function' },
},
description: 'Callback to handle onChange.',
},
},
};

export default meta;

export const Default = {
render: function Template( { onChange, ...args } ) {
const [ values, setValues ] = useState( args.values );

return (
<BorderRadiusControl
{ ...args }
values={ values }
onChange={ ( ...changeArgs ) => {
setValues( ...changeArgs );
onChange( ...changeArgs );
} }
/>
);
},
args: {
values: {
topLeft: '10px',
topRight: '10px',
bottomLeft: '10px',
bottomRight: '10px',
},
},
};
Sukhendu2002 marked this conversation as resolved.
Show resolved Hide resolved
Loading