Skip to content

Commit

Permalink
Refactor: Refactor storybook for letter-spacing-control
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinite-Null committed Dec 6, 2024
1 parent 75affea commit 97ede64
Showing 1 changed file with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
/**
* External dependencies
*/
/**
* Internal dependencies
*/
import LetterSpacingControl from '../';

/**
* The `LetterSpacingControl` component renders a UnitControl that lets the user enter a numeric value and select a unit, for example px or rem.
* The LetterSpacingControl component renders a UnitControl for entering a numeric value with a unit (e.g., px, rem).
*/
const meta = {
title: 'BlockEditor/LetterSpacingControl',
component: LetterSpacingControl,

decorators: [ ( Story ) => <Story /> ],
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description:
'The `LetterSpacingControl` component renders a UnitControl that lets the user enter a numeric value and select a unit, for example px or rem.',
},
},
argTypes: {
onChange: {
action: 'onChange',
description: 'Function to be called when the value is changed',
table: {
type: {
summary: 'function',
},
},
},
value: {
control: 'number',
control: {
type: null,
},
table: {
type: {
summary: 'number',
},
},
description: 'Letter spacing value in pixels, em, or rem.',
},
__next40pxDefaultSize: {
control: {
type: 'boolean',
},
description:
'Start opting into the larger default height for future versions.',
table: {
Expand All @@ -35,6 +52,9 @@ const meta = {
__unstableInputWidth: {
description:
'Width of the input field for letter-spacing, defaults to 60px.',
control: {
type: null,
},
table: {
type: {
summary: 'string|number|undefined',
Expand All @@ -47,20 +67,10 @@ const meta = {
export default meta;

/**
* Default story shows the basic LetterSpacingControl.
* Default story shows the LetterSpacingControl.
*/
export const Default = {
args: {
value: 10,
},
};

/**
* Demonstrates a LetterSpacingControl with unconstrained width.
*/
export const UnconstrainedWidth = {
args: {
...Default.args,
__unstableInputWidth: '100%',
},
};

0 comments on commit 97ede64

Please sign in to comment.