import { jsx } from "@emotion/core";
import { Link } from "react-router";
import { get } from "lodash";
import PropTypes from "prop-types";

var CardLink = function CardLink(_ref) {
  var children = _ref.children,
      slug = _ref.slug;
  var isEmbedded = "".concat(get(window, "location.origin", ""), "/cards/").concat(slug, "/embed/") === get(window, "location.href", "") || "".concat(get(window, "location.origin", ""), "/cards/").concat(slug, "/embed/visualization") === get(window, "location.href", "");
  return jsx("div", null, isEmbedded ? jsx(Link, {
    target: "_blank",
    to: "".concat(get(window, "location.origin"), "/cards/").concat(slug)
  }, jsx("span", null, children)) : jsx(Link, {
    to: "".concat(get(window, "location.origin"), "/cards/").concat(slug)
  }, jsx("span", null, children)));
};

CardLink.displayName = "CardLink";
CardLink.propTypes = {
  children: PropTypes.node,
  slug: PropTypes.string
};
export default CardLink;