Files
TheGame/packages/web/components/Link.tsx
Hammad Jutt 7492ae5bd6 Remove unused pages / components and fix usage of Wrap with WrapItem (#284)
* 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"
2021-01-18 11:44:52 -07:00

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>
);
};