2023-11-09 18:54:04 -08:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
|
|
|
const TabsText = ({
|
|
|
|
tabs,
|
|
|
|
activeTab,
|
|
|
|
onChange,
|
2023-11-10 03:36:35 -08:00
|
|
|
className,
|
2023-11-09 18:54:04 -08:00
|
|
|
}: {
|
|
|
|
tabs: [string, number][]
|
|
|
|
activeTab: string
|
|
|
|
onChange: (tab: string) => void
|
2023-11-10 03:36:35 -08:00
|
|
|
className?: string
|
2023-11-09 18:54:04 -08:00
|
|
|
}) => {
|
2023-11-13 20:41:16 -08:00
|
|
|
const { t } = useTranslation(['common', 'account', 'trade'])
|
2023-11-09 18:54:04 -08:00
|
|
|
return (
|
2023-12-17 21:11:58 -08:00
|
|
|
<div className="flex space-x-4 text-base sm:space-x-6">
|
2023-11-09 18:54:04 -08:00
|
|
|
{tabs.map((tab) => (
|
|
|
|
<button
|
2023-12-17 21:11:58 -08:00
|
|
|
className={`flex items-center space-x-2 font-bold leading-tight focus:outline-none ${
|
2023-11-14 15:53:34 -08:00
|
|
|
activeTab === tab[0]
|
|
|
|
? 'text-th-active md:hover:text-th-active'
|
|
|
|
: 'text-th-fgd-2 md:hover:text-th-fgd-3'
|
2023-11-10 03:36:35 -08:00
|
|
|
} ${className}`}
|
2023-11-09 18:54:04 -08:00
|
|
|
onClick={() => onChange(tab[0])}
|
|
|
|
key={tab[0]}
|
|
|
|
>
|
|
|
|
<span>{t(tab[0])}</span>
|
|
|
|
{tab[1] ? (
|
|
|
|
<div className="rounded-md bg-th-bkg-3 px-1.5 py-0.5 font-body text-xs font-medium text-th-fgd-2">
|
|
|
|
<span>{tab[1]}</span>
|
|
|
|
</div>
|
|
|
|
) : null}
|
|
|
|
</button>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TabsText
|