import { AllDualVariantIconKeys, MenuItem, MenuItemSize } from '@biom3/react'; import { ReactElement } from 'react'; import { useTranslation } from 'react-i18next'; import { FiatOptionType } from '../../widgets/add-tokens/types'; export interface FiatOptionProps< RC extends ReactElement | undefined = undefined, > { rc?: RC; type: FiatOptionType; onClick?: (type: FiatOptionType) => void; disabled?: boolean; size?: MenuItemSize; } export function FiatOption({ type, onClick, disabled = false, size = 'small', rc = , }: FiatOptionProps) { const { t } = useTranslation(); const icon: Record = { [FiatOptionType.DEBIT]: 'BankCard', [FiatOptionType.CREDIT]: 'Craft', }; const handleClick = () => { onClick?.(type); }; const menuItemProps = { disabled, emphasized: true, onClick: disabled ? undefined : handleClick, size, rc, }; return ( {t(`views.ADD_TOKENS.drawer.options.${type}.heading`)} {t( `views.ADD_TOKENS.drawer.options.${type}.${ disabled ? 'disabledCaption' : 'caption' }`, )} {!disabled && } ); }