cal.pub0.org/packages/ui/components/navigation/tabs/HorizontalTabs.tsx

34 lines
911 B
TypeScript
Raw Normal View History

import type { HorizontalTabItemProps } from "./HorizontalTabItem";
import HorizontalTabItem from "./HorizontalTabItem";
export interface NavTabProps {
tabs: HorizontalTabItemProps[];
2023-07-18 21:18:08 +00:00
linkShallow?: boolean;
linkScroll?: boolean;
actions?: JSX.Element;
}
2023-07-18 21:18:08 +00:00
const HorizontalTabs = function ({ tabs, linkShallow, linkScroll, actions, ...props }: NavTabProps) {
return (
<div className="mb-4 h-9 max-w-[calc(100%+40px)] lg:mb-5">
<nav
2023-01-19 12:05:00 +00:00
className="no-scrollbar flex max-h-9 space-x-1 overflow-scroll rounded-md"
aria-label="Tabs"
{...props}>
{tabs.map((tab, idx) => (
2023-07-18 21:18:08 +00:00
<HorizontalTabItem
className="px-4 py-2.5"
{...tab}
key={idx}
linkShallow={linkShallow}
linkScroll={linkScroll}
/>
))}
</nav>
{actions && actions}
</div>
);
};
export default HorizontalTabs;