-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook: Add Story for Block Patterns Setup Component
- Loading branch information
Showing
1 changed file
with
115 additions
and
0 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
packages/block-editor/src/components/block-pattern-setup/stories/index.story.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockPatternSetup from '..'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { registerCoreBlocks } from '@wordpress/block-library'; | ||
import { createBlock } from '@wordpress/blocks'; | ||
|
||
registerCoreBlocks(); | ||
const block = createBlock( 'core/paragraph', { | ||
content: 'Sample paragraph content', | ||
} ); | ||
|
||
/** | ||
* Storybook metadata | ||
*/ | ||
const meta = { | ||
title: 'Components/BlockPatternSetup', | ||
component: BlockPatternSetup, | ||
parameters: { | ||
docs: { | ||
canvas: { | ||
sourceState: 'shown', | ||
}, | ||
description: { | ||
component: | ||
'BlockPatternSetup component displays a list of block patterns in a carousel or grid view.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
clientId: { | ||
control: { type: null }, | ||
description: 'The client ID of the block being edited.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
blockName: { | ||
control: { | ||
type: 'text', | ||
}, | ||
description: 'The name of the block being edited.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
filterPatternsFn: { | ||
control: { type: null }, | ||
description: 'Function to filter patterns.', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
}, | ||
onBlockPatternSelect: { | ||
control: { type: null }, | ||
description: 'Function to call when a pattern is selected.', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
}, | ||
initialViewMode: { | ||
control: { | ||
type: 'text', | ||
}, | ||
description: 'The initial view mode for the block pattern setup.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
showTitles: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
description: 'Whether to show titles for block patterns.', | ||
table: { | ||
type: { | ||
summary: 'boolean', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
/** | ||
* Default story for the BlockPatternSetup component | ||
*/ | ||
export const Default = { | ||
args: { | ||
clientId: block.clientId, | ||
blockName: 'core/paragraph', | ||
filterPatternsFn: null, | ||
onBlockPatternSelect: () => {}, | ||
initialViewMode: 'carousel', | ||
showTitles: true, | ||
}, | ||
render: function Template( args ) { | ||
return <BlockPatternSetup { ...args } />; | ||
}, | ||
}; |