"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

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

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

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

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

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

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

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

var _uiOverlays = require("@instructure/ui-overlays");

var _uiElements = require("@instructure/ui-elements");

var _uiButtons = require("@instructure/ui-buttons");

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-common/lib/format-message"));

var AccommodationModal =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(AccommodationModal, _Component);

  function AccommodationModal() {
    var _getPrototypeOf2;

    var _this;

    (0, _classCallCheck2.default)(this, AccommodationModal);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(AccommodationModal)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.saveAction = function () {
      _this.props.onSubmit && _this.props.onSubmit();

      _this.props.closeModal();
    };

    _this.cancelAction = function () {
      _this.props.onDismiss && _this.props.onDismiss();

      _this.props.closeModal();
    };

    return _this;
  }

  (0, _createClass2.default)(AccommodationModal, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          studentName = _this$props.studentName,
          open = _this$props.open,
          closeModal = _this$props.closeModal,
          children = _this$props.children;
      return _react.default.createElement(_uiOverlays.Modal, {
        open: open,
        label: studentName,
        size: "small"
      }, _react.default.createElement(_uiOverlays.ModalHeader, null, _react.default.createElement(_uiElements.Heading, null, studentName), _react.default.createElement(_uiButtons.CloseButton, {
        onClick: closeModal,
        placement: "end",
        offset: "medium",
        variant: "icon"
      }, "Luk")), _react.default.createElement(_uiOverlays.ModalBody, null, children), _react.default.createElement(_uiOverlays.ModalFooter, null, _react.default.createElement(_uiButtons.Button, {
        onClick: this.cancelAction,
        margin: "xxx-small"
      }, "Annull\xE9r"), _react.default.createElement(_uiButtons.Button, {
        variant: "primary",
        onClick: this.saveAction,
        margin: "xxx-small"
      }, "Save")));
    }
  }]);
  AccommodationModal.displayName = "AccommodationModal";
  return AccommodationModal;
}(_react.Component);

exports.default = AccommodationModal;
AccommodationModal.propTypes = {
  closeModal: _propTypes.default.func.isRequired,
  open: _propTypes.default.bool.isRequired,
  studentName: _propTypes.default.string.isRequired,
  onSubmit: _propTypes.default.func,
  onDismiss: _propTypes.default.func,
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)])
};
AccommodationModal.defaultProps = {
  onSubmit: null,
  onDismiss: null,
  children: []
};