From cef6648db2e010ef76300e8890a1ad8f7036af33 Mon Sep 17 00:00:00 2001 From: SohamPatel46 Date: Fri, 20 Dec 2024 14:45:46 +0530 Subject: [PATCH] Add font sizes story --- .../font-sizes/stories/index.story.js | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 packages/block-editor/src/components/font-sizes/stories/index.story.js diff --git a/packages/block-editor/src/components/font-sizes/stories/index.story.js b/packages/block-editor/src/components/font-sizes/stories/index.story.js new file mode 100644 index 0000000000000..66d5ee38dd1c8 --- /dev/null +++ b/packages/block-editor/src/components/font-sizes/stories/index.story.js @@ -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 ( + { + onChange( ...changeArgs ); + setValue( ...changeArgs ); + } } + /> + ); + }, +};