"use strict";

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

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.QuizInstructions = 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 _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

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

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

var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));

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

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

var _makeScrollable = _interopRequireDefault(require("../../../shared/functionality/makeScrollable"));

var _theme = _interopRequireDefault(require("./theme"));

var _dec, _class, _class2, _temp;

// ================================
// renders the quiz instructions on
// the Preview and Take pages
// ================================
var styles = {
  componentId: 'fchim',
  template: function template(theme) {
    return "\n\n.quiz-core__instructions--wrapper {\n  position: relative;\n  width: 100%;\n  box-sizing: border-box;\n  padding-left: ".concat(theme.wrapperPadding || 'inherit', ";\n}\n\n.quiz-core__instructions--wrapper::after {\n  clear: both;\n  content: \"\";\n  display: table;\n}\n\n[dir=\"ltr\"] .quiz-core__instructions--wrapper::after {\n  clear: both;\n}\n\n[dir=\"rtl\"] .quiz-core__instructions--wrapper::after {\n  clear: both;\n}\n\n.quiz-core__instructions--text {\n  font-size: ").concat(theme.textFontSize || 'inherit', ";\n}\n");
  },
  'wrapper': 'quiz-core__instructions--wrapper',
  'text': 'quiz-core__instructions--text'
};
var QuizInstructions = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(QuizInstructions, _Component);

  function QuizInstructions() {
    (0, _classCallCheck2.default)(this, QuizInstructions);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(QuizInstructions).apply(this, arguments));
  }

  (0, _createClass2.default)(QuizInstructions, [{
    key: "render",
    value: function render() {
      return _react.default.createElement("div", {
        ref: "instructionsPreview",
        className: styles.wrapper
      }, _react.default.createElement(_RichContentRenderer.default, {
        customStyles: styles.text,
        content: this.props.quiz.instructions
      }));
    }
  }]);
  QuizInstructions.displayName = "QuizInstructions";
  return QuizInstructions;
}(_react.Component), _class2.propTypes = {
  quiz: _reactImmutableProptypes.default.record.isRequired
}, _temp)) || _class);
exports.QuizInstructions = QuizInstructions;

var _default = (0, _makeScrollable.default)(QuizInstructions);

exports.default = _default;