import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/react'; import type { ReactNode } from 'react'; export type ProfileTab = 'activity' | 'following' | 'liked'; const TABS: { id: ProfileTab; label: string }[] = [ { id: 'activity', label: 'Activity' }, { id: 'following', label: 'Following' }, { id: 'liked', label: 'Liked' }, ]; interface ProfileTabsProps { activeTab: ProfileTab; onChange: (tab: ProfileTab) => void; panels: Record; } const ProfileTabs = ({ activeTab, onChange, panels }: ProfileTabsProps) => { const selectedIndex = TABS.findIndex((tab) => tab.id === activeTab); return ( onChange(TABS[index].id)}> {TABS.map((tab) => ( {tab.label} ))} {TABS.map((tab) => ( {panels[tab.id]} ))} ); }; export default ProfileTabs;