'use strict';

require('./_commonjsHelpers-06173234.js');
require('./_to-object-329a650b.js');
require('./es6.string.iterator-cc0bbaa4.js');
require('./core.get-iterator-method-f62321d4.js');
require('./web.dom.iterable-a0e279c1.js');
var React = require('react');
var slicedToArray = require('./slicedToArray-8f385299.js');
var Modal = require('react-bootstrap/Modal');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var Modal__default = /*#__PURE__*/_interopDefaultLegacy(Modal);

var PopUpModal = function PopUpModal(props) {
  var _ref = props.ModalImage ? React.useState(true) : React.useState(false),
      _ref2 = slicedToArray._slicedToArray(_ref, 2),
      show = _ref2[0],
      setShow = _ref2[1];

  var launchModalButton = function launchModalButton(e) {
    window.open(props.landingURL, '_blank');
    setShow(false);
  };

  return React__default['default'].createElement(
    Modal__default['default'],
    { show: show, onHide: function onHide() {
        return setShow(false);
      }, 'aria-labelledby': 'Popup-Modal' },
    React__default['default'].createElement(Modal__default['default'].Title, null),
    React__default['default'].createElement(
      Modal__default['default'].Body,
      null,
      React__default['default'].createElement(
        'div',
        { className: 'modalImageHolder' },
        React__default['default'].createElement('img', { className: 'modalImage', src: props.ModalImage, onClick: function onClick() {
            return launchModalButton();
          } }),
        React__default['default'].createElement(
          'div',
          { className: 'modalClose', onClick: function onClick() {
              return setShow(false);
            } },
          'X'
        )
      )
    ),
    React__default['default'].createElement(
      'style',
      { jsx: 'true' },
      '\n          .modalImageHolder {\n            display: flex;\n            justify-content: center;\n          }\n          .modalClose {\n            display: flex;\n            justify-content: center;\n            width: 25px;\n            height: 25px;\n            font-size: 1.25rem;\n            color: #fff;\n            cursor: pointer;\n          }\n          .modalImage {\n            cursor: pointer;\n          }\n        '
    )
  );
};

module.exports = PopUpModal;
