Files
xLog/src/components/site/PostLink.tsx
T
2022-10-06 01:44:14 +01:00

21 lines
420 B
TypeScript

import { Link } from "react-scroll"
export const PostLink: React.FC<any> = ({ children, ...props }) => {
if (props.href?.startsWith("#")) {
return (
<Link
to={decodeURI(props.href.slice(1))}
spy={true}
smooth={true}
duration={500}
offset={-20}
{...props}
>
{children}
</Link>
)
} else {
return <a {...props}>{children}</a>
}
}