"use strict";

exports.__esModule = true;
exports["default"] = void 0;

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

var _reactGridSystem = require("react-grid-system");

var _md = require("react-icons/md");

require("./style.css");

var _this = void 0;

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var Gallery = function Gallery(props) {
  var galleryImages = props.galleryImages,
      onSelectImage = props.onSelectImage,
      onDeleteImage = props.onDeleteImage;
  return galleryImages.map(function (gImage, index) {
    return /*#__PURE__*/_react["default"].createElement(_reactGridSystem.Col, {
      key: index,
      className: "gallery-col",
      sm: 3
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "img-container"
    }, /*#__PURE__*/_react["default"].createElement("button", {
      className: gImage.isSelected ? 'btn-select-img active' : 'btn-select-img',
      onClick: onSelectImage.bind(_this, index)
    }, /*#__PURE__*/_react["default"].createElement(_md.MdCheckCircle, {
      size: "28px"
    })), /*#__PURE__*/_react["default"].createElement("a", {
      href: gImage.src
    }, /*#__PURE__*/_react["default"].createElement("img", {
      className: gImage.isSelected ? 'single-image-gallery active' : 'single-image-gallery',
      alt: gImage.date + ' - Result: ' + gImage.result + '°',
      src: gImage.src
    })), /*#__PURE__*/_react["default"].createElement("button", {
      className: "btn-delete",
      onClick: onDeleteImage.bind(_this, gImage._id)
    }, /*#__PURE__*/_react["default"].createElement(_md.MdDeleteForever, {
      size: "25px"
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: "tags-date"
    }, gImage.date), /*#__PURE__*/_react["default"].createElement("div", {
      className: "tags-result"
    }, gImage.result)));
  });
};

var _default = (0, _react.memo)(Gallery);

exports["default"] = _default;
module.exports = exports.default;