Skip to content

Commit

Permalink
Add font sizes story
Browse files Browse the repository at this point in the history
  • Loading branch information
SohamPatel46 committed Dec 20, 2024
1 parent 7e15fad commit cef6648
Showing 1 changed file with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import FontSizePicker from '../font-size-picker.js';

const meta = {
title: 'BlockEditor/FontSizePicker',
component: FontSizePicker,
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description: {
component:
'Renders a user interface that allows the user to select predefined (common) font sizes.',
},
},
},
argTypes: {
fallbackFontSize: {
control: { type: null },
description:
'Starting position for the font size picker slider, if active.',
table: {
type: {
summary: 'number',
},
},
},
onChange: {
action: 'onChange',
control: { type: null },
table: {
type: { summary: 'function' },
},
description: 'Function executed when the font size changes.',
},
value: {
control: { type: 'number' },
description: 'The current font size value.',
table: {
type: {
summary: 'number',
},
},
},
withSlider: {
control: { type: null },
description:
'To control the UI to contain a slider or a numeric text input field.',
table: {
type: {
summary: 'boolean',
},
},
},
},
};

export default meta;

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

return (
<FontSizePicker
{ ...args }
value={ value }
onChange={ ( ...changeArgs ) => {
onChange( ...changeArgs );
setValue( ...changeArgs );
} }
/>
);
},
};

0 comments on commit cef6648

Please sign in to comment.