Skip to content

Commit

Permalink
[Block Editor]: Fix block variation registration when icon is an `o…
Browse files Browse the repository at this point in the history
…bject` and contains `transform` scope (#41457)

* [Block Editor]: Fix block variation registration when `icon` is an `object` and contains `transform` scope

* show colors
  • Loading branch information
ntsekouras committed Jun 1, 2022
1 parent 56f3baa commit f131c8c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { chevronDown } from '@wordpress/icons';
/**
* Internal dependencies
*/
import BlockIcon from '../block-icon';
import { store as blockEditorStore } from '../../store';

function VariationsButtons( {
Expand All @@ -33,7 +34,7 @@ function VariationsButtons( {
{ variations.map( ( variation ) => (
<Button
key={ variation.name }
icon={ variation.icon }
icon={ <BlockIcon icon={ variation.icon } showColors /> }
isPressed={ selectedValue === variation.name }
label={
selectedValue === variation.name
Expand Down Expand Up @@ -126,7 +127,7 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
}
variations.forEach( ( variation ) => {
if ( variation.icon ) {
variationIcons.add( variation.icon );
variationIcons.add( variation.icon?.src || variation.icon );
}
} );
return variationIcons.size === variations.length;
Expand Down

0 comments on commit f131c8c

Please sign in to comment.