From 0f18e117c2bb5ed6ff2cf80d91bdf519126515d3 Mon Sep 17 00:00:00 2001 From: Eshaan Dabasiya <76681468+im3dabasia@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:22:12 +0530 Subject: [PATCH] Add BlockIcon Storybook stories (#67186) * doc: Add BlockIcon Storybook stories - Demonstrate various icon rendering scenarios * doc: Fix story with patterns * feat: Add story for block icon component * feat: Add table.type for each of the argTypes * fix: Corrected description grammar and default args Co-authored-by: im3dabasia Co-authored-by: t-hamano --- .../block-icon/stories/index.story.js | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 packages/block-editor/src/components/block-icon/stories/index.story.js diff --git a/packages/block-editor/src/components/block-icon/stories/index.story.js b/packages/block-editor/src/components/block-icon/stories/index.story.js new file mode 100644 index 00000000000000..e30a347005d774 --- /dev/null +++ b/packages/block-editor/src/components/block-icon/stories/index.story.js @@ -0,0 +1,69 @@ +/** + * WordPress dependencies + */ +import { box, button, cog, paragraph } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import BlockIcon from '../'; + +const meta = { + title: 'BlockEditor/BlockIcon', + component: BlockIcon, + parameters: { + docs: { + description: { + component: + 'The `BlockIcon` component allows to display an icon for a block.', + }, + canvas: { sourceState: 'shown' }, + }, + }, + argTypes: { + icon: { + control: 'select', + options: [ 'paragraph', 'cog', 'box', 'button' ], + mapping: { + paragraph, + cog, + box, + button, + }, + description: + 'The icon of the block. This can be any of [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.', + table: { + type: { summary: 'string | object' }, + }, + }, + showColors: { + control: 'boolean', + description: 'Whether to show background and foreground colors.', + table: { + type: { summary: 'boolean' }, + }, + }, + className: { + control: 'text', + description: 'Additional CSS class for the icon.', + table: { + type: { summary: 'string' }, + }, + }, + context: { + control: 'text', + description: 'Context where the icon is being used.', + table: { + type: { summary: 'string' }, + }, + }, + }, +}; + +export default meta; + +export const Default = { + args: { + icon: 'paragraph', + }, +};