"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactRouter = require("react-router");

var _core = require("@emotion/core");

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

function _templateObject() {
  var data = _taggedTemplateLiteral(["\n  & a {\n    display: flex;\n    flex-wrap: nowrap;\n    align-items: center;\n    justify-content: space-between;\n    padding: 8px 12px;\n    border-bottom: none;\n    color: #000;\n\n    &:hover {\n      background-color: rgba(0, 0, 0, 0.1);\n      color: #000;\n    }\n\n    & i {\n      margin-right: 12px;\n      opacity: 0.8;\n    }\n  }\n\n  & span {\n    flex-wrap: nowrap;\n  }\n"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

var storyLinkClass = (0, _core.css)(_templateObject());

var StoryLink = function StoryLink(_ref) {
  var children = _ref.children,
      icon = _ref.icon,
      route = _ref.route,
      action = _ref.action,
      link = _ref.link,
      embed = _ref.embed;
  return (0, _core.jsx)("div", {
    css: storyLinkClass
  }, route ? (0, _core.jsx)(_reactRouter.Link, {
    to: route
  }, (0, _core.jsx)("i", {
    className: icon
  }), (0, _core.jsx)("span", null, children)) : embed ? (0, _core.jsx)("a", {
    href: link,
    target: "_blank",
    rel: "noopener noreferrer"
  }, (0, _core.jsx)("i", {
    className: icon
  }), (0, _core.jsx)("span", null, children)) : link ? (0, _core.jsx)("a", {
    href: link
  }, (0, _core.jsx)("i", {
    className: icon
  }), (0, _core.jsx)("span", null, children)) : (0, _core.jsx)("a", {
    tabIndex: "0",
    onClick: action,
    role: "button"
  }, (0, _core.jsx)("i", {
    className: icon
  }), (0, _core.jsx)("span", null, children)));
};

StoryLink.displayName = "StoryLink";
StoryLink.propTypes = {
  action: _propTypes["default"].func,
  children: _propTypes["default"].node,
  icon: _propTypes["default"].string,
  route: _propTypes["default"].string,
  link: _propTypes["default"].string,
  embed: _propTypes["default"].bool
};
var _default = StoryLink;
exports["default"] = _default;