Skip to content

Commit

Permalink
StoryBook: Add story for BlockSettingsMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
im3dabasia committed Jan 16, 2025
1 parent 041ca27 commit 8e854de
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Internal dependencies
*/
import BlockSettingsMenu from '../';

/**
* Storybook metadata
*/
const meta = {
title: 'BlockEditor/BlockSettingsMenu',
component: BlockSettingsMenu,
parameters: {
docs: {
description: {
component:
'The `BlockSettingsMenu` component displays the block settings menu, with options like duplicate, remove, etc. It wraps the `BlockSettingsDropdown` and provides toolbar functionality.',
},
canvas: { sourceState: 'shown' },
},
},
argTypes: {
clientIds: {
control: 'array',
description:
'Array of clientIds for the blocks that will be acted upon. Can be used to control block actions like duplicate or delete.',
table: {
type: { summary: 'Array' },
},
},
__experimentalSelectBlock: {
control: 'function',
description:
'A callback for selecting a block. When provided, interacting with the dropdown options (like duplicate) will not update the editor selection.',
table: {
type: { summary: 'function' },
},
},
},
};

export default meta;

/**
* Default Story
*/
export const Default = {
args: {
clientIds: [ 'block-1', 'block-2' ],
__experimentalSelectBlock: () => {},
},
render: function Template( { clientIds, __experimentalSelectBlock } ) {
return (
<BlockSettingsMenu
clientIds={ clientIds }
__experimentalSelectBlock={ __experimentalSelectBlock }
/>
);
},
};

0 comments on commit 8e854de

Please sign in to comment.