choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
46 lines (38 loc) • 1.52 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import React from 'react';
import classNames from 'classnames';
import { getConfig } from '../configure';
import createFromIconfontCN from './IconFont';
var Icon = function Icon(props) {
var iconfontPrefix = getConfig('iconfontPrefix');
var type = props.type,
customFontName = props.customFontName,
height = props.height,
width = props.width,
_props$className = props.className,
className = _props$className === void 0 ? '' : _props$className,
scriptUrl = props.scriptUrl,
otherProps = _objectWithoutProperties(props, ["type", "customFontName", "height", "width", "className", "scriptUrl"]);
var classString = classNames(iconfontPrefix, customFontName, "".concat(iconfontPrefix, "-").concat(type), className);
if (scriptUrl && typeof document !== 'undefined' && typeof window !== 'undefined' && typeof document.createElement === 'function') {
var SvgIcon = createFromIconfontCN({
scriptUrl: scriptUrl
});
if (SvgIcon) {
return React.createElement(SvgIcon, {
type: type,
width: width,
height: height
});
}
}
return React.createElement("i", _extends({}, otherProps, {
className: classString
}));
};
Icon.displayName = 'Icon';
Icon.createFromIconfontCN = createFromIconfontCN;
Icon.__C7N_ICON = true;
export default Icon;
//# sourceMappingURL=index.js.map