Files
TheGame/packages/web/components/Link.tsx
Alec LaLonde 08bae099a9 Cache ENS lookup (#1542)
* Added usePlayerName and usePlayerURL

* Removed resize handler as it was always rendering regardless of edit status

* re-work player page to avoid duplicate player lookups

* Lint fixes

* Force 5.x version of ethers
2023-04-12 05:54:59 -04:00

44 lines
826 B
TypeScript

import { Link } from '@metafam/ds';
import NextLink, { LinkProps } from 'next/link';
import React from 'react';
type Props = Omit<React.ComponentProps<typeof Link>, keyof LinkProps> &
LinkProps;
export const MetaLink: React.FC<Props> = ({
children,
href,
as,
replace,
scroll = true,
shallow,
isExternal,
...props
}) => {
if (isExternal && typeof href === 'string') {
return (
<Link color="cyan.400" isExternal href={href} {...props}>
{children}
</Link>
);
}
return (
<NextLink
{...{
href,
as,
replace,
scroll,
shallow,
}}
passHref={true}
legacyBehavior={true}
>
{/* NextLink passes the href */}
<Link color="cyan.400" {...props}>
{children}
</Link>
</NextLink>
);
};