'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 _dec, _class, _class2, _temp;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _lib = require('@instructure/ui-themeable/lib');

var _lib2 = _interopRequireDefault(_lib);

var _RichContentRenderer = require('@instructure/quiz-rce/lib/components/RichContentRenderer');

var _RichContentRenderer2 = _interopRequireDefault(_RichContentRenderer);

var _Overlay = require('../../../../../../common/components/shared/overlay/Overlay');

var _Overlay2 = _interopRequireDefault(_Overlay);

var _theme = require('./theme');

var _theme2 = _interopRequireDefault(_theme);

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

var _formatMessage2 = _interopRequireDefault(_formatMessage);

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

var styles = {
  template: function template(theme) {
    return '/*  imported from styles.css  */\n\n.Show__styles__instructionsShowWrapper {\n  position: relative;\n  width: 100%;\n  min-height: 4rem;\n\n  box-sizing: border-box;\n\n  padding: ' + theme.instructionsShowWrapperPadding + ';\n\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n}\n\n.Show__styles__instructionsShowText {\n  white-space: normal;\n  overflow: hidden;\n  font-size: ' + theme.instructionsShowTextFontSize + ';\n}\n';
  },
  'instructionsShowWrapper': 'Show__styles__instructionsShowWrapper',
  'instructionsShowText': 'Show__styles__instructionsShowText'
};


// ==========================================

// this component shows the quiz instructions
// has events that allow for toggling
// editing and hover which shows an overlay

// ==========================================
var QuizInstructionsShow = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp = _class2 = function (_Component) {
  (0, _inherits3.default)(QuizInstructionsShow, _Component);

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

  (0, _createClass3.default)(QuizInstructionsShow, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        _Overlay2.default,
        {
          wrapperClassName: styles.instructionsShowWrapper,
          onClick: this.props.switchOnEditing,
          tabIndex: '-1'
        },
        _react2.default.createElement(
          'div',
          { 'data-automation': 'instructions-show-text' },
          _react2.default.createElement(_RichContentRenderer2.default, {
            customStyles: styles.instructionsShowText,
            content: this.props.instructions || '\u6DFB\u52A0\u6559\u5B78\u2026'
          })
        )
      );
    }
  }]);
  QuizInstructionsShow.displayName = 'QuizInstructionsShow'
  ;
  return QuizInstructionsShow;
}(_react.Component), _class2.propTypes = {
  instructions: _propTypes2.default.string.isRequired,
  switchOnEditing: _propTypes2.default.func.isRequired
}, _temp)) || _class);
exports.default = QuizInstructionsShow;