'use strict';

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

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _class, _temp;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _Button = require('@instructure/ui-buttons/lib/components/Button');

var _Button2 = _interopRequireDefault(_Button);

var _CloseButton = require('@instructure/ui-buttons/lib/components/CloseButton');

var _CloseButton2 = _interopRequireDefault(_CloseButton);

var _Heading = require('@instructure/ui-elements/lib/components/Heading');

var _Heading2 = _interopRequireDefault(_Heading);

var _Modal = require('../../../../Modal');

var _Modal2 = _interopRequireDefault(_Modal);

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

var _formatMessage2 = _interopRequireDefault(_formatMessage);

var _Body = require('../Body');

var _Body2 = _interopRequireDefault(_Body);

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

var AddContentModal = (_temp = _class = function (_Component) {
  (0, _inherits3.default)(AddContentModal, _Component);

  function AddContentModal() {
    (0, _classCallCheck3.default)(this, AddContentModal);
    return (0, _possibleConstructorReturn3.default)(this, (AddContentModal.__proto__ || Object.getPrototypeOf(AddContentModal)).apply(this, arguments));
  }

  (0, _createClass3.default)(AddContentModal, [{
    key: 'cancelButton',
    value: function cancelButton() {
      return _react2.default.createElement(
        _Button2.default,
        { onClick: this.props.closeModal },
        '\u53D6\u6D88'
      );
    }
  }, {
    key: 'renderContent',
    value: function renderContent() {
      return _react2.default.createElement(_Body2.default, {
        allowStimulusCreation: this.props.allowStimulusCreation,
        onOpenBankTray: this.props.closeModal,
        onAddItem: this.props.closeModal,
        parentEntryId: this.props.parentEntryId,
        position: this.props.position,
        quizId: this.props.quizId,
        showHeaderText: false,
        stimulusId: this.props.stimulusId
      });
    }
  }, {
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        null,
        _react2.default.createElement(
          _Modal2.default,
          {
            open: this.props.modalOpen,
            onDismiss: this.props.closeModal,
            size: 'large',
            label: '\u6DFB\u52A0\u5185\u5BB9'
          },
          _react2.default.createElement(
            _Modal.ModalHeader,
            null,
            _react2.default.createElement(
              _Heading2.default,
              { level: 'reset', as: 'h2' },
              '\u63D2\u5165\u5185\u5BB9'
            ),
            _react2.default.createElement(_CloseButton2.default, {
              onClick: this.props.closeModal,
              placement: 'end',
              offset: 'medium',
              variant: 'icon'
            })
          ),
          _react2.default.createElement(
            _Modal.ModalBody,
            null,
            this.renderContent()
          ),
          _react2.default.createElement(
            _Modal.ModalFooter,
            null,
            this.cancelButton()
          )
        )
      );
    }
  }]);
  AddContentModal.displayName = 'AddContentModal'
  ;
  return AddContentModal;
}(_react.Component), _class.propTypes = {
  allowStimulusCreation: _propTypes2.default.bool.isRequired,
  closeModal: _propTypes2.default.func.isRequired,
  modalOpen: _propTypes2.default.bool.isRequired,
  parentEntryId: _propTypes2.default.string,
  position: _propTypes2.default.number.isRequired,
  quizId: _propTypes2.default.string.isRequired,
  stimulusId: _propTypes2.default.string
}, _temp);
exports.default = AddContentModal;