"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

var React = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var Paragraph = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(Paragraph, _React$Component);

  var _super = (0, _createSuper2["default"])(Paragraph);

  function Paragraph() {
    (0, _classCallCheck2["default"])(this, Paragraph);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(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 = (0, _toConsumableArray2["default"])(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: (0, _classnames["default"])(prefixCls, className),
        style: style
      }, rowList);
    }
  }]);
  return Paragraph;
}(React.Component);

var _default = Paragraph;
exports["default"] = _default;
//# sourceMappingURL=Paragraph.js.map
