sendou.ink/components/common/MyLink.tsx
2020-12-02 14:22:02 +02:00

29 lines
630 B
TypeScript

import { Link as ChakraLink } from "@chakra-ui/react";
import { useMyTheme } from "lib/useMyTheme";
import NextLink from "next/link";
interface Props {
children: React.ReactNode;
href: string;
isExternal?: boolean;
}
const MyLink: React.FC<Props> = ({ children, href, isExternal }) => {
const { themeColorShade } = useMyTheme();
if (isExternal) {
return (
<ChakraLink href={href} color={themeColorShade}>
{children}
</ChakraLink>
);
}
return (
<NextLink href={href}>
<ChakraLink color={themeColorShade}>{children}</ChakraLink>
</NextLink>
);
};
export default MyLink;