import * as T from '@radix-ui/react-tabs'; import classnames from 'classnames'; import type { ReactNode } from 'react'; import { Button } from '../Button'; import type { DropdownMenuRadioItem, DropdownMenuRadioProps } from '../Dropdown'; import { DropdownMenuRadio, DropdownMenuTrigger } from '../Dropdown'; import { Icon } from '../Icon'; import { HStack } from '../Stacks'; import './Tabs.css'; interface Props { label: string; onChangeValue: (value: string) => void; value: string; tabs: { value: string; label: string; options?: { onValueChange: DropdownMenuRadioProps['onValueChange']; value: string; items: DropdownMenuRadioItem[]; }; }[]; tabListClassName?: string; className?: string; children: ReactNode; } export function Tabs({ value, onChangeValue, label, children, tabs, className, tabListClassName, }: Props) { return ( {tabs.map((t) => { const isActive = t.value === value; if (t.options && isActive) { return ( ); } else if (t.options && !isActive) { return ( ); } else { return ( ); } })} {children} ); } interface TabContentProps { value: string; children: ReactNode; className?: string; } export function TabContent({ value, children, className }: TabContentProps) { return ( {children} ); }