UNPKG

choerodon-ui

Version:

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

75 lines (60 loc) 2.02 kB
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _createSuper from "@babel/runtime/helpers/createSuper"; import * as React from 'react'; import classNames from 'classnames'; var Paragraph = /*#__PURE__*/function (_React$Component) { _inherits(Paragraph, _React$Component); var _super = _createSuper(Paragraph); function Paragraph() { _classCallCheck(this, Paragraph); return _super.apply(this, arguments); } _createClass(Paragraph, [{ key: "getWidth", value: function getWidth(index) { var _this$props = this.props, width = _this$props.width, _this$props$rows = _this$props.rows, rows = _this$props$rows === void 0 ? 2 : _this$props$rows; if (Array.isArray(width)) { return width[index]; } // last paragraph if (rows - 1 === index) { return width; } return undefined; } }, { key: "render", value: function render() { var _this = this; var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, className = _this$props2.className, style = _this$props2.style, rows = _this$props2.rows; var rowList = _toConsumableArray(Array(rows)).map(function (_, index) { return ( /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key React.createElement("li", { key: index, style: { width: _this.getWidth(index) } }) ); }); return /*#__PURE__*/React.createElement("ul", { className: classNames(prefixCls, className), style: style }, rowList); } }]); return Paragraph; }(React.Component); export default Paragraph; //# sourceMappingURL=Paragraph.js.map