Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 3x 5x 5x 2x 2x 1x 5x 5x 3x | import type { Transaction } from './transaction-table';
import BitcoinIcon from '../../../assets/icons/bitcoin.svg';
import CardIcon from '../../../assets/icons/card.svg';
import {
TRANSACTION_TYPES,
TRANSACTION_TYPE_ALT,
} from '@/constants/transaction';
import { memo } from 'react';
type TransactionTypeIconProps = {
type: Transaction['type'];
};
export const TransactionTypeIcon = memo(
({ type }: TransactionTypeIconProps) => {
const getTypeConfig = (type: Transaction['type']) => {
switch (type) {
case TRANSACTION_TYPES.BITCOIN:
return {
className: 'w-8 h-8 flex items-center justify-center',
icon: (
<img
src={BitcoinIcon}
alt={TRANSACTION_TYPE_ALT[TRANSACTION_TYPES.BITCOIN]}
className="w-full h-full"
/>
),
};
case TRANSACTION_TYPES.CARD:
return {
className: 'w-8 h-8 flex items-center justify-center',
icon: (
<img
src={CardIcon}
alt={TRANSACTION_TYPE_ALT[TRANSACTION_TYPES.CARD]}
className="w-full h-full"
/>
),
};
default:
return {
className:
'w-8 h-8 bg-gray-200 text-default rounded-full flex items-center justify-center text-sm',
icon: TRANSACTION_TYPE_ALT.DEFAULT,
};
}
};
const config = getTypeConfig(type);
return <div className={config.className}>{config.icon}</div>;
}
);
TransactionTypeIcon.displayName = 'TransactionTypeIcon';
|