mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: cached styling
This commit is contained in:
1 parent
1d65dc755f
commit
ff4be57faf
5 files changed
+97
-89
No files matched your search
+23
-19
@@ -2,25 +2,29 @@
|
||||
|
||||
import { LinkProps, Link as RadixLink } from '@radix-ui/themes';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
export function Link({ href, onClick, ...props }: LinkProps) {
|
||||
const router = useRouter();
|
||||
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
||||
({ href, onClick, ...props }, ref) => {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<RadixLink
|
||||
href={href}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
if (href) {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
window.open(href);
|
||||
} else {
|
||||
router.push(href);
|
||||
return (
|
||||
<RadixLink
|
||||
ref={ref}
|
||||
href={href}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
if (href) {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
window.open(href);
|
||||
} else {
|
||||
router.push(href);
|
||||
}
|
||||
}
|
||||
}
|
||||
onClick?.(event);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
onClick?.(event);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user