This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
2021-03-29 21:32:17 +00:00
|
|
|
import * as React from "react";
|
|
|
|
import { Link as GatsbyLink } from "gatsby";
|
|
|
|
|
2021-03-31 11:24:05 +00:00
|
|
|
export default function Link({
|
|
|
|
children,
|
|
|
|
to,
|
|
|
|
activeClassName,
|
2021-03-31 16:12:18 +00:00
|
|
|
partiallyActive = to !== "/",
|
2021-03-31 11:24:05 +00:00
|
|
|
target = "_blank",
|
|
|
|
rel = "noopener noreferrer",
|
|
|
|
...params
|
|
|
|
}) {
|
2021-03-29 21:32:17 +00:00
|
|
|
if (to) {
|
|
|
|
return (
|
|
|
|
<GatsbyLink to={to} activeClassName={activeClassName} partiallyActive={partiallyActive} {...params}>
|
|
|
|
{children}
|
|
|
|
</GatsbyLink>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-03-31 11:24:05 +00:00
|
|
|
return (
|
|
|
|
<a {...params} target={target} rel={rel}>
|
|
|
|
{children}
|
|
|
|
</a>
|
|
|
|
);
|
2021-03-29 21:32:17 +00:00
|
|
|
}
|