Dashicon module replacement: prevent cloning a non-element (https://github.com/woocommerce/woocommerce-blocks/pull/2804)
This commit is contained in:
parent
c49a7af270
commit
2013c5e0f5
|
@ -13,9 +13,7 @@ import { cloneElement } from '@wordpress/element';
|
||||||
// the Webpack NormalModuleReplacementPlugin plugin.
|
// the Webpack NormalModuleReplacementPlugin plugin.
|
||||||
|
|
||||||
export default function( props ) {
|
export default function( props ) {
|
||||||
let Icon = function() {
|
let Icon;
|
||||||
return null;
|
|
||||||
};
|
|
||||||
switch ( props.icon ) {
|
switch ( props.icon ) {
|
||||||
case 'arrow-down-alt2':
|
case 'arrow-down-alt2':
|
||||||
Icon = ArrowDownIcon;
|
Icon = ArrowDownIcon;
|
||||||
|
@ -24,6 +22,11 @@ export default function( props ) {
|
||||||
Icon = DismissIcon;
|
Icon = DismissIcon;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! Icon ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return cloneElement( Icon, {
|
return cloneElement( Icon, {
|
||||||
size: props.size || 20,
|
size: props.size || 20,
|
||||||
className: props.className,
|
className: props.className,
|
||||||
|
|
Loading…
Reference in New Issue