"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 React = _interopRequireWildcard(require("react"));

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

var _grid = require("../grid");

function getGrid(grid, t) {
  return grid && grid[t] && Math.floor(24 / grid[t]);
}

var Grid = function Grid(props) {
  var renderContent = function renderContent() {
    var column = props.column,
        prefixCls = props.prefixCls;

    if (column) {
      var col = column;
      var cols = [];

      while (col && col > 0) {
        cols.push( /*#__PURE__*/React.createElement(_grid.Col, {
          span: getGrid(props, 'column'),
          xs: getGrid(props, 'xs'),
          sm: getGrid(props, 'sm'),
          md: getGrid(props, 'md'),
          lg: getGrid(props, 'lg'),
          xl: getGrid(props, 'xl'),
          xxl: getGrid(props, 'xxl')
        }, /*#__PURE__*/React.createElement("div", {
          className: "".concat(prefixCls, "-content")
        })));
        col--;
      }

      return cols;
    }

    return /*#__PURE__*/React.createElement(_grid.Col, null, /*#__PURE__*/React.createElement("div", {
      className: "".concat(prefixCls, "-content")
    }));
  };

  var prefixCls = props.prefixCls,
      className = props.className,
      style = props.style,
      rows = props.rows,
      gutter = props.gutter;
  var rowList = /*#__PURE__*/React.createElement(_grid.Row, {
    gutter: gutter
  }, (0, _toConsumableArray2["default"])(Array(rows)).map(function () {
    return renderContent();
  }));
  return /*#__PURE__*/React.createElement("div", {
    className: (0, _classnames["default"])(prefixCls, className),
    style: style
  }, rowList);
};

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