"use strict";

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

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

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 _lib = _interopRequireDefault(require("@instructure/ui-themeable/lib"));

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

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

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'bFiTq',
  template: function template(theme) {
    return "\n\n.bFiTq_VGME{border-bottom:".concat(theme.titleShowWrapperBottomBorder || 'inherit', ";box-sizing:border-box;display:flex;flex-direction:column;height:5rem;justify-content:center;padding-left:").concat(theme.titleShowWrapperLeftPadding || 'inherit', ";position:relative;width:100%}\n\n.bFiTq_ftIr{font-size:").concat(theme.titleShowTextFontSize || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}");
  },
  'titleShowWrapper': 'bFiTq_VGME',
  'titleShowText': 'bFiTq_ftIr'
};
var QuizTitleShow = ( // ====================================
// this component shows the quiz title
// has events that allow for toggling
// editing and hover which shows an
// overlay
// ====================================
_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(QuizTitleShow, _Component);

  function QuizTitleShow() {
    var _getPrototypeOf2;

    var _this;

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

    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)(QuizTitleShow)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.switchOnEditing = function () {
      _this.props.switchOnEditing();
    };

    return _this;
  }

  (0, _createClass2.default)(QuizTitleShow, [{
    key: "render",
    value: function render() {
      return _react.default.createElement("span", {
        "data-automation": "sdk-quiz-title-show-wrapper"
      }, _react.default.createElement(_Overlay.default, {
        wrapperClassName: styles.titleShowWrapper,
        onClick: this.switchOnEditing,
        tabIndex: "-1"
      }, _react.default.createElement("span", {
        className: styles.titleShowText,
        "data-automation": "sdk-quiz-title-show-title"
      }, this.props.defaultTitle)));
    }
  }]);
  QuizTitleShow.displayName = "QuizTitleShow";
  return QuizTitleShow;
}(_react.Component), _class2.propTypes = {
  defaultTitle: _propTypes.default.string.isRequired,
  switchOnEditing: _propTypes.default.func.isRequired
}, _temp)) || _class);
exports.default = QuizTitleShow;