"use strict";

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

exports.__esModule = true;
exports.ProductList = ProductList;

var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _lib = require("@sentecacommerce-theme/lib");

var _Common = require("../../../Common");

var _templateObject;

function ProductList(_ref) {
  var hasSeoAgg = _ref.hasSeoAgg,
      items = _ref.items,
      contentInside = _ref.contentInside;
  return /*#__PURE__*/_react["default"].createElement(Wrapper, {
    hasSeoAgg: hasSeoAgg
  }, items == null ? void 0 : items.map(function (item, index) {
    if (item.isPlaceholder) {
      return /*#__PURE__*/_react["default"].createElement("article", {
        key: index + "__PLACEHOLDER"
      }, /*#__PURE__*/_react["default"].createElement(_Common.LineItemPlaceholder, null));
    }

    var content = (0, _lib.getListingInsideContent)(contentInside, index);
    return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
      key: "Product__" + item._id + "-" + item.variantId
    }, Boolean(content == null ? void 0 : content.length) && /*#__PURE__*/_react["default"].createElement(_lib.RenderInjectedContent, {
      componentList: content
    }), /*#__PURE__*/_react["default"].createElement("article", {
      "data-key": "Product__" + item._id + "-" + item.slug
    }, /*#__PURE__*/_react["default"].createElement(_Common.LineItem, {
      data: item
    })));
  }));
}

var Wrapper = _styledComponents["default"].div.attrs(function (props) {
  return {
    className: "row gx-2 gx-lg-3 gy-5 align-items-stretch " + (props.hasSeoAgg ? 'row-cols-2 row-cols-lg-3' : 'row-cols-2 row-cols-md-3 row-cols-lg-4')
  };
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])([""])));
//# sourceMappingURL=index.js.map