Skip to content

Commit

Permalink
Doc: add story file for BlockCard
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinite-Null committed Nov 21, 2024
1 parent b7d989e commit 2cb93fc
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions packages/block-editor/src/components/block-card/stories/index.story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* WordPress dependencies
*/
import { box, button, cog, paragraph } from '@wordpress/icons';

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

/**
* BlockCard component displays information about a block including its icon, title, and description.
*/
const meta = {
title: 'BlockEditor/BlockCard',
component: BlockCard,
parameters: {
docs: {
description: {
component:
'BlockCard component displays block information, including icon, title, and description.',
},
canvas: { sourceState: 'shown' },
},
},
decorators: [ ( Story ) => <Story /> ],
argTypes: {
title: {
control: 'text',
description: 'The title of the block',
},
description: {
control: 'text',
description: 'A description of the block functionality',
},
icon: {
control: 'select',
options: [ 'paragraph', 'cog', 'box', 'button' ],
mapping: {
paragraph,
cog,
box,
button,
},
description: 'The icon to display for the block',
},
name: {
control: 'text',
description: 'Optional custom name for the block',
},
className: {
control: 'text',
description: 'Additional CSS class names',
},
},
};

export default meta;

/**
* Default story shows the basic BlockCard with title, icon and description.
*/
export const Default = {
args: {
title: 'Paragraph',
icon: paragraph,
description: 'Start with the building block of all narrative.',
},
};

/**
* This story demonstrates the BlockCard with a name.
*/
export const Name = {
args: {
...Default.args,
name: 'Custom Name',
},
};

/**
* This story demonstrates the BlockCard with a description.
*/
export const Description = {
args: {
...Default.args,
description:
'Start with the building block of all narrative. Paragraph is a good block for text-heavy content.',
},
};

/**
* This story demonstrates the BlockCard with a icon
*/
export const Icon = {
args: {
...Default.args,
icon: box,
title: 'Box Icon',
},
};

export const Title = {
args: {
...Default.args,
title: 'A Custom Title',
},
};

0 comments on commit 2cb93fc

Please sign in to comment.