otterscan/src/components/NavTab.tsx

29 lines
621 B
TypeScript
Raw Normal View History

2021-09-06 06:43:20 +00:00
import React, { Fragment } from "react";
2021-07-01 18:21:40 +00:00
import { NavLink } from "react-router-dom";
2021-09-06 06:43:20 +00:00
import { Tab } from "@headlessui/react";
2021-07-01 18:21:40 +00:00
2021-09-06 06:34:13 +00:00
type NavTabProps = {
2021-07-01 18:21:40 +00:00
href: string;
};
2021-09-06 06:34:13 +00:00
const NavTab: React.FC<NavTabProps> = ({ href, children }) => (
2021-09-06 06:43:20 +00:00
<Tab as={Fragment}>
<NavLink
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`
}
2021-09-06 06:43:20 +00:00
to={href}
exact
replace
>
{children}
</NavLink>
</Tab>
2021-07-01 18:21:40 +00:00
);
2021-09-06 06:34:13 +00:00
export default NavTab;