Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BlockIcon Storybook stories #67186

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Internal dependencies
*/
import BlockIcon from '../';

/**
* WordPress dependencies
*/
import { paragraph } from '@wordpress/icons';

const meta = {
title: 'BlockEditor/BlockIcon',
component: BlockIcon,
parameters: {
docs: { canvas: { sourceState: 'shown' } },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good idea to add a description of this component via the parameters.docs.description.component field.

},
argTypes: {
icon: {
control: 'block',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such control.type as block. A better solution would be to use an SVG icon of the actual block via the select control, similar to what we did with the BlockCard component.

description:
'The icon to display. Can be a custom icon or a predefined WordPress icon.',
},
showColors: {
control: 'boolean',
description: 'Whether to show background and foreground colors.',
},
className: {
control: 'text',
description: 'Additional CSS class for the icon.',
},
context: {
control: 'text',
description: 'Context where the icon is being used.',
},
},
};

export default meta;

export const Default = {
args: {
icon: paragraph,
showColors: false,
className: '',
context: 'default',
},
};
Loading