Skip to content

Commit

Permalink
add block-breadcrumb story
Browse files Browse the repository at this point in the history
  • Loading branch information
torounit committed Dec 15, 2024
1 parent 6e85888 commit 4921146
Showing 1 changed file with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* WordPress dependencies
*/
import { createBlock } from '@wordpress/blocks';
import { registerCoreBlocks } from '@wordpress/block-library';

/**
* Internal dependencies
*/
import Breadcrumb from '../';
import { ExperimentalBlockEditorProvider } from '../../provider';

// For the purpose of this story, we need to register the core blocks samples.
registerCoreBlocks();
const blocks = [
// vertical
createBlock( 'core/group', {}, [
createBlock( 'core/paragraph' ),
createBlock( 'core/paragraph' ),
createBlock( 'core/paragraph' ),
] ),
];

const selection = {
selectionEnd: {
clientId: blocks[ 0 ].innerBlocks[ 0 ].clientId,
},
selectionStart: {
clientId: blocks[ 0 ].innerBlocks[ 0 ].clientId,
},
};

const meta = {
title: 'BlockEditor/Breadcrumb',
component: Breadcrumb,
argTypes: {
rootLabelText: {
control: 'text',
defaultValue: 'Document',
description:
'Translated label for the root element of the breadcrumb trail',
},
},
decorators: [
( Story ) => (
<ExperimentalBlockEditorProvider
value={ blocks }
selection={ selection }
>
<Story />
</ExperimentalBlockEditorProvider>
),
],
};
export default meta;

export const Default = {
render: function Template( { onChange, ...args } ) {
return <Breadcrumb { ...args } />;
},
};

0 comments on commit 4921146

Please sign in to comment.