yqcloud-ui
Version:
An enterprise-class UI design language and React-based implementation
40 lines (33 loc) • 1.45 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import * as React from 'react';
import classNames from 'classnames';
import omit from 'omit.js';
import icons from './icons';
var Icon = function (_React$Component) {
_inherits(Icon, _React$Component);
function Icon() {
_classCallCheck(this, Icon);
return _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).apply(this, arguments));
}
_createClass(Icon, [{
key: 'render',
value: function render() {
var _props = this.props,
type = _props.type,
_props$className = _props.className,
className = _props$className === undefined ? '' : _props$className;
var classString = classNames(_defineProperty({
'icon': true
}, 'icon-' + type, true), className);
return React.createElement('i', _extends({}, omit(this.props, ['type', 'spin']), { className: classString }));
}
}]);
return Icon;
}(React.Component);
Icon.icons = icons;
export default Icon;