@gechiui/block-editor
Version:
46 lines (39 loc) • 1 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* GeChiUI dependencies
*/
import { Icon } from '@gechiui/components';
import { blockDefault } from '@gechiui/icons';
import { memo } from '@gechiui/element';
function BlockIcon(_ref) {
var _icon;
let {
icon,
showColors = false,
className
} = _ref;
if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') {
icon = {
src: blockDefault
};
}
const renderedIcon = createElement(Icon, {
icon: icon && icon.src ? icon.src : icon
});
const style = showColors ? {
backgroundColor: icon && icon.background,
color: icon && icon.foreground
} : {};
return createElement("span", {
style: style,
className: classnames('block-editor-block-icon', className, {
'has-colors': showColors
})
}, renderedIcon);
}
export default memo(BlockIcon);
//# sourceMappingURL=index.js.map