import noop from "lodash/noop"; import Link from "next/link"; import { useRouter } from "next/router"; import { FC, Fragment, MouseEventHandler } from "react"; import { ChevronRight } from "react-feather"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { SVGComponent } from "@calcom/types/SVGComponent"; export type VerticalTabItemProps = { name: string; info?: string; icon?: SVGComponent; disabled?: boolean; } & ( | { /** If you want to change query param tabName as per current tab */ href: string; tabName?: never; } | { href?: never; /** If you want to change the path as per current tab */ tabName: string; } ); const VerticalTabItem: FC = ({ name, href, tabName, info, ...props }) => { const router = useRouter(); const { t } = useLocale(); let newHref = ""; let isCurrent; if (href) { newHref = href; isCurrent = router.asPath === href; } else if (tabName) { newHref = ""; isCurrent = router.query.tabName === tabName; } const onClick: MouseEventHandler = tabName ? (e) => { e.preventDefault(); router.push({ query: { ...router.query, tabName, }, }); } : noop; return ( {props.icon && }

{t(name)}

{info &&

{t(info)}

}
{isCurrent && (
)}
); }; export default VerticalTabItem;