modified router link

This commit is contained in:
Maximus 2022-08-18 11:34:36 +03:00
parent d21ed03508
commit b82eb8290b

View File

@ -1 +1,18 @@
export { NavLink as RouterLink } from "react-router-dom";
import classNames from "classnames";
import { NavLink, NavLinkProps, To } from "react-router-dom";
type Props = {
enabled?: boolean;
children?: React.ReactNode;
} & NavLinkProps;
export function RouterLink({ children, enabled = true, className, to }: Props) {
return (
<NavLink
to={to}
className={classNames({ "pointer-events-none": !enabled }, className)}
>
{children}
</NavLink>
);
}