2022-09-04 14:59:16 +00:00
|
|
|
import { classNames } from "@calcom/lib";
|
|
|
|
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { VerticalTabItemProps } from "./VerticalTabItem";
|
|
|
|
import VerticalTabItem from "./VerticalTabItem";
|
2022-07-23 00:39:50 +00:00
|
|
|
|
2022-09-05 16:16:42 +00:00
|
|
|
export { VerticalTabItem };
|
|
|
|
|
2022-09-18 23:14:57 +00:00
|
|
|
export interface NavTabProps {
|
|
|
|
tabs: VerticalTabItemProps[];
|
2022-08-26 00:11:41 +00:00
|
|
|
children?: React.ReactNode;
|
|
|
|
className?: string;
|
2022-09-04 14:59:16 +00:00
|
|
|
sticky?: boolean;
|
2023-07-18 21:18:08 +00:00
|
|
|
linkShallow?: boolean;
|
|
|
|
linkScroll?: boolean;
|
2022-12-18 10:56:21 +00:00
|
|
|
itemClassname?: string;
|
2023-04-18 23:29:02 +00:00
|
|
|
iconClassName?: string;
|
2022-07-23 00:39:50 +00:00
|
|
|
}
|
|
|
|
|
2023-04-18 23:29:02 +00:00
|
|
|
const NavTabs = function ({
|
|
|
|
tabs,
|
|
|
|
className = "",
|
|
|
|
sticky,
|
2023-07-18 21:18:08 +00:00
|
|
|
linkShallow,
|
|
|
|
linkScroll,
|
2023-04-18 23:29:02 +00:00
|
|
|
itemClassname,
|
|
|
|
iconClassName,
|
|
|
|
...props
|
|
|
|
}: NavTabProps) {
|
2022-07-23 00:39:50 +00:00
|
|
|
return (
|
2022-09-04 14:59:16 +00:00
|
|
|
<nav
|
2022-09-07 01:33:50 +00:00
|
|
|
className={classNames(
|
2023-03-08 23:16:26 +00:00
|
|
|
`no-scrollbar flex flex-col space-y-0.5 overflow-scroll ${className}`,
|
2022-09-08 14:34:37 +00:00
|
|
|
sticky && "sticky top-0 -mt-7"
|
2022-09-07 01:33:50 +00:00
|
|
|
)}
|
2022-09-04 14:59:16 +00:00
|
|
|
aria-label="Tabs"
|
|
|
|
{...props}>
|
2022-09-08 14:34:37 +00:00
|
|
|
{/* padding top for sticky */}
|
|
|
|
{sticky && <div className="pt-6" />}
|
2022-08-26 00:11:41 +00:00
|
|
|
{props.children}
|
|
|
|
{tabs.map((tab, idx) => (
|
2023-04-18 23:29:02 +00:00
|
|
|
<VerticalTabItem
|
|
|
|
{...tab}
|
|
|
|
key={idx}
|
2023-07-18 21:18:08 +00:00
|
|
|
linkShallow={linkShallow}
|
|
|
|
linkScroll={linkScroll}
|
2023-04-18 23:29:02 +00:00
|
|
|
className={itemClassname}
|
|
|
|
iconClassName={iconClassName}
|
|
|
|
/>
|
2022-08-26 00:11:41 +00:00
|
|
|
))}
|
|
|
|
</nav>
|
2022-07-23 00:39:50 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default NavTabs;
|