Skip to content

Commit

Permalink
Storybook: Add stories for BlockCard component (#67191)
Browse files Browse the repository at this point in the history
* Doc: add story file for BlockCard

* Refactor: Refactor `block-card` storybook

* Refactor: Remove redundant doc comment

* Refactor: `BlockCard` story docs

* Refactor: `BlockCard` story docs

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent c9c6830 commit 3159fa2
Showing 1 changed file with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* WordPress dependencies
*/
import { box, button, cog, paragraph } from '@wordpress/icons';

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

const meta = {
title: 'BlockEditor/BlockCard',
component: BlockCard,
parameters: {
docs: {
description: {
component:
'The `BlockCard` component allows to display a "card" which contains the title of a block, its icon and its description.',
},
canvas: { sourceState: 'shown' },
},
},
argTypes: {
title: {
control: 'text',
description: 'The title of the block.',
table: {
type: { summary: 'string' },
},
},
description: {
control: 'text',
description: 'A description of the block functionality.',
table: {
type: { summary: 'string' },
},
},
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' },
},
},
name: {
control: 'text',
description: 'Optional custom name for the block.',
table: {
type: { summary: 'string' },
},
},
className: {
control: 'text',
description: 'Additional CSS class names.',
table: {
type: { summary: 'string' },
},
},
},
};

export default meta;

export const Default = {
args: {
title: 'Paragraph',
icon: paragraph,
description: 'This is a paragraph block description.',
name: 'Paragraph Block',
},
};

1 comment on commit 3159fa2

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 3159fa2.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12394788508
📝 Reported issues:

Please sign in to comment.