import type React from "react"; import { Fragment } from "react"; import { Mono } from "@components/generic/Mono"; import { Tab } from "@headlessui/react"; export interface TabType { name: string; icon?: JSX.Element; element: () => JSX.Element; disabled?: boolean; disabledMessage?: string; disabledLink?: string; } export interface TabbedCOntentAction { icon: JSX.Element; action: () => void; } export interface TabbedContentProps { tabs: TabType[]; actions?: TabbedCOntentAction[]; } export const TabbedContent = ({ tabs, actions }: TabbedContentProps): JSX.Element => { return ( {tabs.map((entry, index) => ( {({ selected }) => (
{entry.icon && (
{entry.icon}
)} {entry.name}
)}
))}
{actions?.map((action, index) => (
{action.icon}
))}
{tabs.map((entry, index) => ( {!entry.disabled ? ( ) : (
{entry.disabledMessage || "This tab is disabled"}.{" "} {entry.disabledLink && ( <> Click{" "} here {" "} for more information. )}
)}
))}
); };