refactor(website): use gatbsy link for doc links, add ids for headlines
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Link as GatsbyLink } from 'gatsby';
|
||||
|
||||
const Link = ({ children, to, activeClassName, partiallyActive, ...other }) => {
|
||||
const internal = /^\/(?!\/)/.test(to);
|
||||
|
||||
if (internal) {
|
||||
return (
|
||||
<GatsbyLink
|
||||
to={to}
|
||||
activeClassName={activeClassName}
|
||||
partiallyActive={partiallyActive}
|
||||
{...other}
|
||||
>
|
||||
{children}
|
||||
</GatsbyLink>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a href={to} {...other}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
export default Link;
|
||||
Reference in New Issue
Block a user