import * as MonoIcons from './icons' import { QuestionMarkCircleIcon } from '@heroicons/react/solid' import { useTranslation } from 'next-i18next' const TabButtons = ({ tabs, activeTab, showSymbolIcon, onClick, }: { tabs: Array<{ label: string; key: string }> activeTab: string showSymbolIcon?: boolean onClick: (x) => void }) => { const { t } = useTranslation('common') const renderSymbolIcon = (s) => { const iconName = `${s.slice(0, 1)}${s.slice(1, 4).toLowerCase()}MonoIcon` const SymbolIcon = MonoIcons[iconName] || QuestionMarkCircleIcon return } return (
{tabs.map((tab) => (
onClick(tab.key)} role="button" key={tab.key} > {showSymbolIcon ? renderSymbolIcon(tab.label) : null} {t(tab.label.toLowerCase().replace(/\s/g, '-'))}
))}
) } export default TabButtons