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

Add a grey block for the editor preview. #51

Closed
wants to merge 2 commits into from

Conversation

StevenDufresne
Copy link
Contributor

@StevenDufresne StevenDufresne commented Mar 5, 2020

This PR:

  • Adds a grey block to the block editor for previews.

Block Preview


const EditView = ( { className } ) => {
return (
<div className={ className }>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, the icon that comes out of the icon package and the dashicon that is provided to the block config are different. I definitely want to keep the icon because when it's not focused, it's not evident that the block is related.

It's also a bit confusing to me that the @wordpress/icons package doesn't resolve unless its explicitly installed. Any idea what's going on there?

ScreenShot

Copy link
Contributor

Choose a reason for hiding this comment

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

I just tried out <Placeholder icon="calendar" label="Placeholder"> enclosing the text, and got matching icons:

Screen Shot 2020-03-06 at 3 58 04 pm

I have no idea why, just blindly copying code.

Copy link
Contributor Author

@StevenDufresne StevenDufresne Mar 6, 2020

Choose a reason for hiding this comment

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

Weird. The example has the SVG exported and then the reference passed in. I guess, if you just pass the string it falls back to dashicons. That's unexpected. I can update.

Copy link
Contributor Author

@StevenDufresne StevenDufresne Mar 6, 2020

Choose a reason for hiding this comment

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

Yeah, that's apparently how it works:

icon.js

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think they've been updating to move away from dashicons in general, so @wordpress/icons is a new package of new icons, but it's still in transition — see WordPress/gutenberg#20464

It's also a bit confusing to me that the @wordpress/icons package doesn't resolve unless its explicitly installed.

Might be a versioning issue, if you're not using the GB plugin, or using an older version.

@StevenDufresne
Copy link
Contributor Author

Prefer #60

@StevenDufresne StevenDufresne deleted the try/block-preview branch March 6, 2020 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants