"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = LoginModal;

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactIntl = require("react-intl");

var _cspaceLayout = require("cspace-layout");

var _LoginFormContainer = _interopRequireDefault(require("../../containers/login/LoginFormContainer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const formId = 'loginModal.loginForm';

const renderButtonBar = () => null;

const messages = (0, _reactIntl.defineMessages)({
  title: {
    "id": "loginModal.title",
    "defaultMessage": "Sign In"
  }
});
const propTypes = {
  isOpen: _propTypes.default.bool,
  onCloseButtonClick: _propTypes.default.func,
  onSuccess: _propTypes.default.func
};

function LoginModal(props) {
  const {
    isOpen,
    onCloseButtonClick,
    onSuccess
  } = props;

  if (!isOpen) {
    return null;
  }

  return _react.default.createElement(_cspaceLayout.Modal, {
    isOpen: isOpen,
    title: _react.default.createElement("h1", null, _react.default.createElement(_reactIntl.FormattedMessage, messages.title)),
    closeButtonClassName: "material-icons",
    closeButtonLabel: "close",
    renderButtonBar: renderButtonBar,
    onCloseButtonClick: onCloseButtonClick
  }, _react.default.createElement(_LoginFormContainer.default, {
    formId: formId,
    isExpired: true,
    showForgotLink: false,
    showHeader: false,
    onSuccess: onSuccess
  }));
}

LoginModal.modalName = 'LoginModal';
LoginModal.propTypes = propTypes;