"use strict";

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

exports.__esModule = true;
exports.PromotionsPage = void 0;

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 _PromotionsList = require("./Components/PromotionsList");

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

var _templateObject, _templateObject2, _templateObject3, _templateObject4;

var PromotionsPage = function PromotionsPage(_ref) {
  var labels = _ref.labels;

  var _viewsApi$getByTag = _lib.viewsApi.getByTag('promotion'),
      data = _viewsApi$getByTag.data,
      isLoading = _viewsApi$getByTag.isLoading;

  return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(Title, null, labels.title), isLoading ? /*#__PURE__*/_react["default"].createElement(CenterContainer, null, /*#__PURE__*/_react["default"].createElement(_Common.Loader, null)) : !!(data != null && data.results.length) ? /*#__PURE__*/_react["default"].createElement(_PromotionsList.PromotionsList, {
    data: data,
    labels: labels
  }) : /*#__PURE__*/_react["default"].createElement(CenterContainer, null, /*#__PURE__*/_react["default"].createElement(Text, null, labels.noPromotions)));
};

exports.PromotionsPage = PromotionsPage;

var Container = _styledComponents["default"].div.attrs({
  className: 'container-md-fluid pb-5 pb-lg-0'
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var Title = (0, _styledComponents["default"])(_Common.Typography).attrs({
  variant: '2',
  as: 'h1',
  className: 'my-4 mx-2 mx-lg-0'
})(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var CenterContainer = _styledComponents["default"].div.attrs({
  className: 'd-flex justify-content-center align-items-center'
})(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  min-height: calc(100vh - (20rem + 40rem));\n"])));

var Text = (0, _styledComponents["default"])(_Common.Typography).attrs({
  variant: 'base',
  as: 'p'
})(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2["default"])([""])));
//# sourceMappingURL=promotionsPage.component.js.map