UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

99 lines (81 loc) 2.82 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import Icon from '../icon'; var IconItem = /*#__PURE__*/ function (_PureComponent) { _inherits(IconItem, _PureComponent); var _super = _createSuper(IconItem); function IconItem() { var _this; _classCallCheck(this, IconItem); _this = _super.apply(this, arguments); _this.handleClick = function () { var _this$props = _this.props, onSelect = _this$props.onSelect, type = _this$props.type; onSelect(type); }; return _this; } _createClass(IconItem, [{ key: "render", value: function render() { var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, type = _this$props2.type, active = _this$props2.active, customFontName = _this$props2.customFontName; return React.createElement("li", { className: classNames(_defineProperty({}, "".concat(prefixCls, "-item-selected"), active)) }, React.createElement("div", { onClick: this.handleClick }, React.createElement(Icon, { customFontName: customFontName, type: type }), React.createElement("p", null, type))); } }]); return IconItem; }(PureComponent); export { IconItem as default }; IconItem.displayName = 'IconItem'; IconItem.propTypes = { prefixCls: PropTypes.string, active: PropTypes.bool.isRequired, type: PropTypes.string.isRequired, onSelect: PropTypes.func.isRequired, customFontName: PropTypes.string }; //# sourceMappingURL=IconItem.js.map