asi-calculator/components/TokenLogo/TokenLogo.tsx

39 lines
955 B
TypeScript
Raw Permalink Normal View History

import agixImage from '@/images/agix.png'
import asiImage from '@/images/asi.png'
import cudosImage from '@/images/cudos.png'
import fetImage from '@/images/fet.png'
import oceanImage from '@/images/ocean.png'
import type { Token } from '@/types'
import styles from './TokenLogo.module.css'
2024-03-31 16:58:26 +02:00
export function TokenLogo({
token,
size = 24
}: {
token: Token | undefined
size?: number
}) {
const imageSrc =
token?.symbol === 'OCEAN'
? oceanImage
: token?.symbol === 'AGIX'
? agixImage
: token?.symbol === 'ASI'
? asiImage
: token?.symbol === 'CUDOS'
? cudosImage
: fetImage
2024-03-31 16:58:26 +02:00
return token ? (
<span className={styles.logo} data-symbol={token.symbol}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={imageSrc.src}
2024-03-31 16:58:26 +02:00
width={size}
height={size}
alt={`${token.symbol} Logo`}
2024-03-31 16:58:26 +02:00
/>
</span>
) : null
}