-
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 Styles Component
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
packages/block-editor/src/components/block-styles/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,83 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockStyles from '..'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { registerCoreBlocks } from '@wordpress/block-library'; | ||
import { createBlock } from '@wordpress/blocks'; | ||
import { dispatch } from '@wordpress/data'; | ||
|
||
registerCoreBlocks(); | ||
|
||
const blockEditorState = [ createBlock( 'core/paragraph' ) ]; | ||
|
||
dispatch( 'core/block-editor' ).resetBlocks( blockEditorState ); | ||
|
||
const meta = { | ||
title: 'BlockEditor/BlockStyles', | ||
component: BlockStyles, | ||
parameters: { | ||
docs: { | ||
canvas: { | ||
sourceState: 'shown', | ||
}, | ||
description: { | ||
component: | ||
'The `BlockStyles` component renders a list of block styles for a given block.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
clientId: { | ||
control: { | ||
type: 'text', | ||
}, | ||
description: 'The block client ID.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
onSwitch: { | ||
control: { | ||
type: 'function', | ||
}, | ||
description: 'Callback to switch the block style.', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
defaultValue: 'noop', | ||
}, | ||
onHoverClassName: { | ||
control: { | ||
type: 'function', | ||
}, | ||
description: 'Callback to set the hover class name.', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
defaultValue: 'noop', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
args: { | ||
clientId: blockEditorState[ 0 ].clientId, | ||
onSwitch: () => {}, | ||
onHoverClassName: () => {}, | ||
}, | ||
render: function Template( args ) { | ||
return <BlockStyles { ...args } />; | ||
}, | ||
}; |