Skip to content

Commit

Permalink
fix: Removed extra stories and addedparameters in meta
Browse files Browse the repository at this point in the history
  • Loading branch information
im3dabasia committed Dec 23, 2024
1 parent da9cedf commit f79dd0a
Showing 1 changed file with 20 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import { useState, useEffect } from '@wordpress/element';
*/
import UnitControl from '../';

const CUSTOM_UNITS = [
{ value: 'px', label: 'px', default: 0 },
{ value: 'em', label: 'em', default: 0 },
{ value: 'rem', label: 'rem', default: 0 },
];

/**
* UnitControl Properties
*/
export default {
const meta = {
title: 'BlockEditor/UnitControl',
component: UnitControl,
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description: {
component:
'UnitControl allows the user to set a numeric quantity as well as a unit ',
},
},
},
argTypes: {
onChange: {
action: 'onChange',
Expand All @@ -36,7 +36,7 @@ export default {
},
},
labelPosition: {
control: 'select',
control: 'radio',
options: [ 'top', 'side', 'bottom' ],
description: 'The position of the label.',
table: {
Expand All @@ -59,12 +59,12 @@ export default {
},
},
size: {
control: 'select',
options: [ 'small', 'medium' ],
control: 'radio',
options: [ 'default', 'small' ],
description: 'The size of the control.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'medium' },
defaultValue: { summary: 'default' },
},
},
disabled: {
Expand All @@ -76,7 +76,12 @@ export default {
},
},
},
render: function Render( { onChange, onUnitChange, value, ...args } ) {
};

export default meta;

export const Default = {
render: function Template( { onChange, onUnitChange, value, ...args } ) {
const [ componentValue, setComponentValue ] = useState( value || '' );

useEffect( () => {
Expand All @@ -100,37 +105,3 @@ export default {
);
},
};

/**
* Story demonstrating UnitControl with default settings
*/
export const Default = {
args: {
label: 'Default Unit Control',
value: '10',
size: 'medium',
labelPosition: 'top',
},
};

/**
* Story demonstrating UnitControl with custom units
*/
export const CustomUnits = {
args: {
...Default.args,
label: 'Custom Units',
units: CUSTOM_UNITS,
},
};

/**
* Story demonstrating UnitControl in disabled state
*/
export const Disabled = {
args: {
...Default.args,
label: 'Disabled Unit Control',
disabled: true,
},
};

0 comments on commit f79dd0a

Please sign in to comment.