mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-22 17:33:18 +01:00
44 lines
972 B
TypeScript
44 lines
972 B
TypeScript
import styles from './ResultRow.module.css'
|
|
import { formatNumber } from '@/utils'
|
|
import Image from 'next/image'
|
|
|
|
type Props = {
|
|
tokenSymbol: string
|
|
tokenAddress: string
|
|
amount: number
|
|
amountAsi: number
|
|
amountFiat: number
|
|
}
|
|
|
|
export function Result({
|
|
tokenSymbol,
|
|
tokenAddress,
|
|
amount,
|
|
amountAsi,
|
|
amountFiat
|
|
}: Props) {
|
|
return (
|
|
<div className={styles.result}>
|
|
<p>
|
|
<span className={styles.logo} data-symbol={tokenSymbol}>
|
|
<Image
|
|
src={`https://tokens.1inch.io/${tokenAddress}.png`}
|
|
width={24}
|
|
height={24}
|
|
alt={tokenSymbol}
|
|
/>
|
|
</span>
|
|
|
|
{formatNumber(amount || 0, tokenSymbol)}
|
|
</p>
|
|
<p className={styles.conversion}>
|
|
→{' '}
|
|
<strong title={`${amountAsi}`}>
|
|
{formatNumber(amountAsi || 0, 'ASI')}
|
|
</strong>{' '}
|
|
= <strong>{formatNumber(amountFiat || 0, 'USD')}</strong>
|
|
</p>
|
|
</div>
|
|
)
|
|
}
|