Skip to content

Commit

Permalink
doc: Fix story with patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
im3dabasia committed Dec 26, 2024
1 parent 7baf454 commit 6c2673b
Showing 1 changed file with 8 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,45 +1,22 @@
/**
* WordPress dependencies
*/
import { registerCoreBlocks } from '@wordpress/block-library';
import { paragraph, heading, image } from '@wordpress/icons';
import { Toolbar } from '@wordpress/components';

/**
* Internal dependencies
*/
import BlockIcon from '../';

// Register core blocks for the story
registerCoreBlocks();

/**
* BlockIcon component demonstrates rendering icons for different block types
* WordPress dependencies
*/
import { paragraph } from '@wordpress/icons';

const meta = {
title: 'BlockEditor/BlockIcon',
component: BlockIcon,
parameters: {
docs: { canvas: { sourceState: 'shown' } },
},
decorators: [
( Story ) => (
<Toolbar label="Block Icon">
<Story />
</Toolbar>
),
],
argTypes: {
icon: {
control: {
type: 'select',
options: {
Paragraph: paragraph,
Heading: heading,
Image: image,
'Default Block': 'block-default',
},
},
control: 'block',
description:
'The icon to display. Can be a custom icon or a predefined WordPress icon.',
},
Expand All @@ -57,56 +34,14 @@ const meta = {
},
},
};

export default meta;

/**
* Default story showing a paragraph icon
*/
export const Default = {
args: {
icon: paragraph,
},
};

/**
* Story showing the default block icon
*/
export const DefaultBlockIcon = {
args: {
icon: { src: 'block-default' },
},
};

/**
* Story showing an icon with colors
*/
export const WithColors = {
args: {
icon: {
src: image,
background: '#f0f0f0',
foreground: '#333',
},
showColors: true,
},
};

/**
* Story showing an icon with a custom class
*/
export const WithCustomClass = {
args: {
icon: heading,
className: 'my-custom-block-icon',
},
};

/**
* Story showing an icon with a specific context
*/
export const WithContext = {
args: {
icon: paragraph,
context: 'inserter',
showColors: false,
className: '',
context: 'default',
},
};

0 comments on commit 6c2673b

Please sign in to comment.