"use strict";

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

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

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

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

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

var _stores = require("../../stores.context");

var _ScrollView = require("../../../Common/ScrollView");

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

var _templateObject, _templateObject2, _templateObject3;

var StoreList = function StoreList(_ref) {
  var renderStore = _ref.renderStore;

  var _useStoresContext = (0, _stores.useStoresContext)(),
      stores = _useStoresContext.stores;

  var labels = (0, _lib.useStrings)('stores');
  return /*#__PURE__*/_react["default"].createElement(_ScrollView.ScrollView, {
    maxHeight: "52rem"
  }, /*#__PURE__*/_react["default"].createElement(List, null, stores.length ? stores.map(function (store) {
    return /*#__PURE__*/_react["default"].createElement(ListItem, {
      id: "Store_" + store.latitude + "x" + store.longitude,
      key: "Store_" + store.latitude + "-" + store.longitude
    }, renderStore(store));
  }) : /*#__PURE__*/_react["default"].createElement(NoStoresFound, null, labels.noStoresFoundLabel)));
};

exports.StoreList = StoreList;

var List = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  max-height: 52rem;\n  width: 100%;\n\n  border-top: 1px solid ", ";\n"])), function (_ref2) {
  var theme = _ref2.theme;
  return theme.palette.grey;
});

var ListItem = _styledComponents["default"].li(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  cursor: pointer;\n\n  border-bottom: 0.1rem solid ", ";\n"])), function (_ref3) {
  var theme = _ref3.theme;
  return theme.palette.grey;
});

var NoStoresFound = _styledComponents["default"].li.attrs({
  className: 'mt-1'
})(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2["default"])([""])));
//# sourceMappingURL=index.js.map