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

Try: Block Patterns: Add support for icons and display next to the pattern title in the inserter #29022

Conversation

andrewserong
Copy link
Contributor

Description

This is an exploration into adding icon support to block patterns, similar to how we can add an icon when registering a block pattern. The idea is that a plugin or theme might want to include an icon when registering a block pattern, to help highlight or distinguish between different kinds of block patterns.

For a user, when plugins or themes use an icon, it might make it easier to see where your patterns are coming from.

How has this been tested?

Manually. This is a draft PR at the moment, so I've hard-coded a test pattern that you can see under the Text category to demonstrate how it might look.

To-dos

Note: if this idea has merit, more work will need to be done to properly filter / update the icon object. For example:

Screenshots

An example of a (very) simple pattern with an icon added:

image

Types of changes

New feature (non-breaking change — patterns without an icon continue to render as before in the pattern inserter).

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • 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.

@@ -241,3 +241,31 @@ function register_site_icon_url( $response ) {
add_filter( 'rest_index', 'register_site_icon_url' );

add_theme_support( 'widgets-block-editor' );

function register_test_block_patterns() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a test pattern to make it easier to try out the icon.

@andrewserong andrewserong changed the title Block Patterns: Add support for icons and display next to the pattern title in the inserter Try: Block Patterns: Add support for icons and display next to the pattern title in the inserter Feb 16, 2021
Base automatically changed from master to trunk March 1, 2021 15:45
@skorasaurus skorasaurus added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Mar 2, 2021
@andrewserong
Copy link
Contributor Author

Closing this one out now as it was an old experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants