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.
|
||||
|
||||
export default function( props ) {
|
||||
let Icon = function() {
|
||||
return null;
|
||||
};
|
||||
let Icon;
|
||||
switch ( props.icon ) {
|
||||
case 'arrow-down-alt2':
|
||||
Icon = ArrowDownIcon;
|
||||
|
@ -24,6 +22,11 @@ export default function( props ) {
|
|||
Icon = DismissIcon;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! Icon ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return cloneElement( Icon, {
|
||||
size: props.size || 20,
|
||||
className: props.className,
|
||||
|
|
Loading…
Reference in New Issue