import { Link } from "react-router"; import { isHttpMode } from "src/utils/isHttpMode"; import { openLink } from "src/utils/openLink"; type Props = React.HTMLAttributes & { to: string; children?: React.ReactNode; }; export default function ExternalLink({ to, children, ...props }: Props) { const _isHttpMode = isHttpMode(); return _isHttpMode ? ( {children} ) : ( { props.onClick?.(e); if (!e.defaultPrevented) { openLink(to); } }} > {children} ); }