1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-04-17 10:28:46 -04:00

use memo more wisely

This commit is contained in:
2022-01-22 10:06:24 -05:00
parent 224358fd68
commit d06ebfcf60
11 changed files with 70 additions and 107 deletions

View File

@@ -41,16 +41,7 @@ const getFancyLinkStyles = ({ lightColor, darkColor }: Partial<Props>) => {
`;
};
const ColorfulLink = ({
href,
title,
lightColor,
darkColor,
external = false,
className,
children,
...rest
}: Props) => {
const ColorfulLink = ({ href, lightColor, darkColor, external = false, className, ...rest }: Props) => {
const { className: underlineClassName, styles: underlineStyles } = getFancyLinkStyles({ lightColor, darkColor });
return (
@@ -58,13 +49,10 @@ const ColorfulLink = ({
<Link href={href} passHref={true} prefetch={false}>
<a
className={classNames(underlineClassName, className)}
title={title}
target={external ? "_blank" : undefined}
rel={external ? "noopener noreferrer" : undefined}
{...rest}
>
{children}
</a>
/>
</Link>
{underlineStyles}