Skip to content

Commit

Permalink
Link: fix isInternal isExternal var
Browse files Browse the repository at this point in the history
  • Loading branch information
Marguerite Roth committed Aug 15, 2021
1 parent 4db6c02 commit 6769e8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/_ui/Link/Link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { OutboundLink } from 'gatsby-plugin-google-analytics';
import "./Link.scss";

const Link = ({ to, buttonProps, isButton, doOpenInNewTab, className, children, ...props }) => {
const isInternal = to || /^\/(?!\/)/.test(to)
const isExternal = (!to || !to.startsWith('/'));

const parsedClassName = useMemo(() => classNames(
"Link",
{ "Link--is-button": isButton },
className,
), [isButton, className])

if (!isInternal) return (
if (isExternal) return (
<OutboundLink
className={parsedClassName}
href={to}
Expand Down

0 comments on commit 6769e8e

Please sign in to comment.