"use strict";

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

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.ReturnButton = 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 _propTypes = _interopRequireDefault(require("prop-types"));

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

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

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

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

  (0, _createClass2.default)(ReturnButton, [{
    key: "render",
    value: function render() {
      if (!this.props.returnToUrl) {
        return null;
      }

      return _react.default.createElement(_Button.default, {
        "data-automation": "sdk-return-button",
        href: this.props.returnToUrl,
        target: "_top"
      }, "Til baka");
    }
  }]);
  ReturnButton.displayName = "ReturnButton";
  return ReturnButton;
}(_react.Component);

exports.ReturnButton = ReturnButton;
ReturnButton.propTypes = {
  returnToUrl: _propTypes.default.string
};
var _default = ReturnButton;
exports.default = _default;