import * as T from '@radix-ui/react-tabs'; import classnames from 'classnames'; import type { ReactNode } from 'react'; import { useState } 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 { defaultValue?: string; label: string; tabs: { value: string; label: string; options?: { onValueChange: DropdownMenuRadioProps['onValueChange']; value: string; items: DropdownMenuRadioItem[]; }; }[]; tabListClassName?: string; className?: string; children: ReactNode; } export function Tabs({ defaultValue, label, children, tabs, className, tabListClassName }: Props) { const [value, setValue] = useState(defaultValue); 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} ); }