2020-01-31 18:20:33 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2020-03-10 11:20:40 +00:00
|
|
|
import { cloneElement, isValidElement } from 'wordpress-element';
|
2020-01-31 18:20:33 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
function Icon( { srcElement, size = 24, ...props } ) {
|
|
|
|
return (
|
|
|
|
isValidElement( srcElement ) &&
|
|
|
|
cloneElement( srcElement, {
|
|
|
|
width: size,
|
|
|
|
height: size,
|
|
|
|
...props,
|
|
|
|
} )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-10 13:24:02 +00:00
|
|
|
Icon.propTypes = {
|
2020-02-17 16:45:27 +00:00
|
|
|
srcElement: PropTypes.element,
|
2020-01-31 18:20:33 +00:00
|
|
|
size: PropTypes.number,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Icon;
|