'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ReturnButton = 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 _formatMessage = require('../../../format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

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

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

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

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

      return _react2.default.createElement(
        _Button2.default,
        {
          'data-automation': 'sdk-return-button',
          href: this.props.returnToUrl,
          target: '_top'
        },
        '\xC5terg\xE5'
      );
    }
  }]);
  ReturnButton.displayName = 'ReturnButton'
  ;
  return ReturnButton;
}(_react.Component), _class.propTypes = {
  returnToUrl: _propTypes2.default.string
}, _temp);
exports.default = ReturnButton;