diff --git a/app/components/common/Link.tsx b/app/components/common/Link.tsx index 1dc34f5..a9c00ea 100644 --- a/app/components/common/Link.tsx +++ b/app/components/common/Link.tsx @@ -1,4 +1,5 @@ import { usePageContext } from "vike-react/usePageContext"; +import { prefetch } from "vike/client/router"; import clsx from "clsx"; export function Link(props: React.AnchorHTMLAttributes & { href: string }) { @@ -7,6 +8,8 @@ export function Link(props: React.AnchorHTMLAttributes & { hr const isSameDomain = !(props.href.startsWith("http") || props.href.startsWith("mailto")); const isDownload = props.href.endsWith(".pdf") || props.href.endsWith(".zip"); + const handleMouseEnter = () => prefetch(props.href); + return ( & { hr className={clsx(isActive && "is-active", props.className)} {...(isDownload ? { download: true } : {})} {...(!isSameDomain || isDownload ? { target: "_blank", rel: "noopener noreferrer" } : {})} + {...(isSameDomain ? { onMouseEnter: handleMouseEnter } : {})} > {props.children} diff --git a/og_maker.afphoto~lock~ b/og_maker.afphoto~lock~ index 3bfcaed..98c3643 100644 Binary files a/og_maker.afphoto~lock~ and b/og_maker.afphoto~lock~ differ