Skip to content

Commit

Permalink
Storybook: Add Block Canvas Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishit30G committed Jan 10, 2025
1 parent b80c1e9 commit 249a177
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 { BlockCanvas, BlockList } from '../..';

const meta = {
title: 'BlockEditor/BlockCanvas',
component: BlockCanvas,
parameters: {
docs: {
canvas: { sourceState: 'shown' },
description: {
component:
'The BlockCanvas component is used to render the canvas for the block editor.',
},
},
},
argTypes: {
children: {
control: false, // Disable direct control for `children` as it defaults to `BlockList`
description: 'The children to render in the canvas.',
table: {
type: { summary: 'node' },
defaultValue: { summary: 'BlockList' },
},
},
height: {
control: 'text',
description: 'The height of the canvas.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '300px' },
},
},
styles: {
control: 'object',
description: 'The styles to apply to the canvas.',
table: {
type: { summary: 'object' },
},
},
},
};

export default meta;

export const Default = {
args: {
height: '300px',
styles: {
border: '1px solid #ccc',
backgroundColor: '#f9f9f9',
},
children: <BlockList />, // Default `children` is `BlockList`
},
render: function Template( args ) {
return <BlockCanvas { ...args } />;
},
};

0 comments on commit 249a177

Please sign in to comment.