Files
vf_react/boilerplate-chakra-pro-main/components/link/NavLink.tsx
2025-11-22 11:41:56 +08:00

32 lines
617 B
TypeScript

'use client';
import NextLink, { LinkProps as NextLinkProps } from 'next/link';
import {
CSSProperties,
ComponentProps,
PropsWithChildren,
useMemo,
} from 'react';
export type NavLinkProps = NextLinkProps &
PropsWithChildren & {
styles?: CSSProperties;
borderRadius?: ComponentProps<typeof NextLink>['style'];
};
function NavLink({ children, styles, ...props }: NavLinkProps) {
const memoizedStyles = useMemo(
() => ({
...styles,
}),
[styles],
);
return (
<NextLink style={memoizedStyles} {...props}>
{children}
</NextLink>
);
}
export default NavLink;