WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

Custom icon for custom template part area #36814

Open dinhtungdu opened 2 years ago

dinhtungdu commented 2 years ago

What problem does this address?

This issue comes from https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5221

Currently, we only support 4 icons for template part areas and there is no way plugins/themes can use custom icons for custom areas.

What is your proposed solution?

Custom template part area can have a custom icon.

gziolo commented 1 year ago

Currently, we only support 4 icons for template part areas and there is no way plugins/themes can use custom icons for custom areas.

I see that the same function is duplicated for the block:

https://github.com/WordPress/gutenberg/blob/12791ecf33385e490ccd1ec01be9bf752e2b99ed/packages/block-library/src/template-part/variations.js#L13-L22

The following lines:

https://github.com/WordPress/gutenberg/blob/12791ecf33385e490ccd1ec01be9bf752e2b99ed/packages/block-library/src/template-part/variations.js#L54-L56

make me wonder if you can register a block variation with the icon expressed as a React element?