{"size": 774, "ext": "js", "max_stars_repo_path": "components/link.js", "max_stars_repo_name": "sergiodxa/personal-slides", "max_stars_repo_stars_event_min_datetime": "2018-04-15T02:52:46.000Z", "max_stars_repo_stars_event_max_datetime": "2018-04-20T23:02:51.000Z", "max_issues_repo_path": "components/link.js", "max_issues_repo_name": "sergiodxa/personal-slides", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "components/link.js", "max_forks_repo_name": "sergiodxa/personal-slides", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.35, "max_line_length": 61, "alphanum_fraction": 0.4263565891}
import Link from "next/link";

export default ({ children, href, external: _external }) => {
  const external = !href.startsWith("/") || _external;

  if (external) {
    return (
      <a href={href} target="_blank">
        {children}
        <style jsx>{`
          a {
            color: black;
            text-decoration: underline;
          }
          :global(main.dark) a {
            color: white;
          }
        `}</style>
      </a>
    );
  }

  return (
    <Link href={href}>
      <a href={href}>
        {children}
        <style jsx>{`
          a {
            color: black;
            text-decoration: underline;
          }
          :global(main.dark) a {
            color: white;
          }
        `}</style>
      </a>
    </Link>
  );
};
