import React from "react" const TabsContext = React.createContext(null) export const Tabs = ({ children, defaultValue, value, onValueChange, className }: any) => { const [activeTab, setActiveTab] = React.useState(value || defaultValue || "") const handleValueChange = (newValue: string) => { setActiveTab(newValue) onValueChange?.(newValue) } return (
{children}
) } export const TabsContent = ({ children, value, className }: any) => { const context = React.useContext(TabsContext) const isActive = context?.activeTab === value return isActive ? (
{children}
) : null } export const TabsList = ({ children, className }: any) => (
{children}
) export const TabsTrigger = ({ children, value }: any) => { const context = React.useContext(TabsContext) const isActive = context?.activeTab === value return ( ) }