mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-08 13:05:15 -05:00
* Remove unused pages / components * Add WrapItem around components inside Wrap component New version of Chakra requires WrapItem around any components that have Wrap * Update LoginButton to link to own profile and show Avatar (#285) * Update LoginButton to link to own profile and show Avatar * Change SetupUsername to explicitly mention "username"
43 lines
828 B
TypeScript
43 lines
828 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,
|
|
passHref,
|
|
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={href}
|
|
as={as}
|
|
passHref={passHref || true}
|
|
replace={replace}
|
|
scroll={scroll}
|
|
shallow={shallow}
|
|
>
|
|
{/* NextLink passes the href */}
|
|
<Link color="cyan.400" {...props}>
|
|
{children}
|
|
</Link>
|
|
</NextLink>
|
|
);
|
|
};
|