Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook: Add BlockCanvas Component #68589

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Rishit30G
Copy link
Contributor

@Rishit30G Rishit30G commented Jan 10, 2025

Part of #67165

What?

This PR adds Story for Block Canvas Component

Testing Instructions

Screenshots or screencast

image

@Rishit30G Rishit30G marked this pull request as ready for review January 10, 2025 09:29
@Rishit30G Rishit30G requested a review from ellatrix as a code owner January 10, 2025 09:29
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Rishit30G <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Developer Documentation Documentation for developers Storybook Storybook and its stories for components labels Jan 11, 2025
Comment on lines +50 to +53
styles: {
border: '1px solid #ccc',
backgroundColor: '#f9f9f9',
},
Copy link
Contributor

@stokesman stokesman Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styles is an array of objects and the actual CSS is a string. A basic example is the variable used in the playground stories.

As for the type, I'm not sure how thoroughly it can/should be documented so maybe for now Array suffices. The full type would be something like: { css?: string; assets?: string; isGlobalStyles?: boolean; __unstableType: string; }[]. Example usage is here and you can see how it’s consumed in EditorStyles

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing the feedback and resources @stokesman

Here is the updated code snippet:

meta object:

styles: {
	control: 'object',
	description: 'The styles to apply to the canvas.',
	table: {
	  type: {
	    summary:
	      '[{ css?: string; assets?: string; isGlobalStyles?: boolean; __unstableType: string; }]',
	   },
	 },
      },

Default object:

export const Default = {
	args: {
		height: '100px',
		styles: [ { css: `body{font-size: 16px;}` } ],
		children: <BlockList />,
	},
	render: function Template( args ) {
		return (
			<BlockCanvas { ...args } />
		);
	},
};

Screenshot of the storybook

image

Let me know if this looks good, I'll update the PR accordingly 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storybook Storybook and its stories for components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants