"use strict";

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

exports.__esModule = true;
exports.ConsentsList = 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 _Common = require("../../../../../../../Common");

var _templateObject, _templateObject2;

var ConsentsList = function ConsentsList(_ref) {
  var _Object$keys;

  var allSubs = _ref.allSubs,
      checkedSubs = _ref.checkedSubs,
      clickSub = _ref.clickSub;

  var _useGlobalLabels = (0, _lib.useGlobalLabels)(),
      productRestock = _useGlobalLabels.productRestock;

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      marginTop: '1rem'
    }
  }, (_Object$keys = Object.keys(allSubs != null ? allSubs : {})) == null ? void 0 : _Object$keys.map(function (sub, i) {
    return /*#__PURE__*/_react["default"].createElement(Check, {
      key: "sub__" + i
    }, /*#__PURE__*/_react["default"].createElement(_Common.Checkbox, {
      onChange: function onChange() {
        return clickSub(sub);
      },
      isChecked: checkedSubs == null ? void 0 : checkedSubs[sub],
      size: "small"
    }), /*#__PURE__*/_react["default"].createElement("p", {
      style: {
        width: '100%',
        cursor: 'pointer'
      },
      onClick: function onClick() {
        return clickSub(sub);
      }
    }, allSubs == null ? void 0 : allSubs[sub].label));
  })), /*#__PURE__*/_react["default"].createElement(Description, {
    notice: true
  }, productRestock.GDPRNotice));
};

exports.ConsentsList = ConsentsList;

var Check = _styledComponents["default"].span.attrs({
  className: 'd-flex align-items-center'
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  & > div {\n    align-items: center;\n    justify-content: center;\n    height: 2.4rem;\n    & > div {\n      margin: auto auto;\n      width: fit-content !important;\n      height: fit-content !important;\n    }\n  }\n"])));

var Description = (0, _styledComponents["default"])(_Common.Typography).attrs({
  variant: 5
})(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  max-width: 50rem;\n  ", "\n"])), function (_ref2) {
  var notice = _ref2.notice,
      theme = _ref2.theme;
  return notice && "\n    align-self: flex-end;\n    font-size: 1.2rem;\n    opacity: 0.8;\n    max-width: 100%;\n    @media (min-width: " + theme.breakpoints.lg.min + ") {\n      max-width: 91%;\n    }\n  ";
});
//# sourceMappingURL=index.js.map