Migrate deprecated attribute activeClassname

This commit is contained in:
Willian Mitsuda 2021-09-23 21:27:40 -03:00
parent 30e458c547
commit 0ede7cf3c9
1 changed files with 7 additions and 4 deletions

View File

@ -6,13 +6,16 @@ type NavTabProps = {
href: string;
};
// TODO: migrate activeClassName because of: https://github.com/remix-run/react-router/releases/tag/v5.3.0
// TODO: @types/react-router-dom still doesn't support function in className
const NavTab: React.FC<NavTabProps> = ({ href, children }) => (
<Tab as={Fragment}>
<NavLink
className="text-gray-500 border-transparent hover:text-link-blue text-sm font-bold px-3 py-3 border-b-2"
activeClassName="text-link-blue border-link-blue"
className={(isActive) =>
`${
isActive
? "text-link-blue border-link-blue"
: "text-gray-500 border-transparent"
} hover:text-link-blue text-sm font-bold px-3 py-3 border-b-2`
}
to={href}
exact
replace