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

Fix missing buttons example #24249

Merged
merged 1 commit into from
Jul 28, 2020
Merged

Fix missing buttons example #24249

merged 1 commit into from
Jul 28, 2020

Conversation

retlehs
Copy link
Contributor

@retlehs retlehs commented Jul 28, 2020

Description

The buttons block is missing an example from the block inserter

The button block has an example, but it isn't used from the inserter

How has this been tested?

I forked and git clone'd the repo, built the plugin locally and loaded on my local dev WP running 5.4.2 and no other plugins, default theme

Screenshots

Before

Screen Shot 2020-07-28 at 12 41 05 PM

After

Screen Shot 2020-07-28 at 12 45 00 PM

Types of changes

Enhancement: This makes sure that the buttons block preview shows an example

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@Soean
Copy link
Member

Soean commented Jul 28, 2020

The buttons block contains inner blocks of the type core/button. If you want to preview custom buttons, you have to add inner blocks:

	example: {
		innerBlocks: [
			{
				name: 'core/button',
				attributes: {
					className: 'is-style-fill',
					backgroundColor: 'vivid-green-cyan',
					text: __( 'Call to Action' ),
				},
			},
		],
	},

If you want to show the example like in the screenshot, you just need to add an empty object:

	example: {},

@Soean Soean added [Block] Buttons Affects the Buttons Block [Type] Enhancement A suggestion for improvement. labels Jul 28, 2020
@retlehs
Copy link
Contributor Author

retlehs commented Jul 28, 2020

@Soean thank you! i updated this PR to just pass the empty example object and it still produces the same output as you mentioned

please let me know if there's any other changes i should make

Copy link
Member

@Soean Soean left a comment

Choose a reason for hiding this comment

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

I think it's good for the example preview. Thanks for contributing!

@Soean Soean merged commit 478c31c into WordPress:master Jul 28, 2020
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 28, 2020
@github-actions github-actions bot added this to the Gutenberg 8.7 milestone Jul 28, 2020
@retlehs retlehs deleted the fix-missing-buttons-example branch July 28, 2020 21:42
@@ -23,6 +23,7 @@ export const settings = {
),
icon,
keywords: [ __( 'link' ) ],
example: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can be more creative and use something close to the two or three buttons pattern here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants