Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/site/components/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ import type { FC, AnchorHTMLAttributes, ComponentProps } from 'react';
import { Link as LocalizedLink } from '#site/navigation.mjs';

export type LinkProps =
| ComponentProps<typeof LocalizedLink>
| AnchorHTMLAttributes<HTMLAnchorElement>;
| AnchorHTMLAttributes<HTMLAnchorElement>
| ComponentProps<typeof LocalizedLink>;

const Link: FC<LinkProps> = ({ href, ...props }) => {
if (!href || /^https?:/.test(href as string)) {
return <a href={href as string} {...props} />;
}

return <LocalizedLink href={href} {...props} />;
return (
<LocalizedLink
href={href}
{...(props as Omit<ComponentProps<typeof LocalizedLink>, 'href'>)}
/>
);
};

export default Link;
2 changes: 1 addition & 1 deletion apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"next-themes": "~0.4.6",
"postcss-calc": "~10.1.1",
"react": "catalog:",
"react-dom": "^19.1.1",
"react-dom": "^19.2.0",
"reading-time": "~1.5.0",
"rehype-autolink-headings": "~7.1.0",
"rehype-slug": "~6.0.0",
Expand Down
Loading
Loading