1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-29 00:57:50 +02:00
market/src/components/atoms/Price.tsx

28 lines
546 B
TypeScript
Raw Normal View History

2020-05-07 08:03:30 +02:00
import React from 'react'
import Web3 from 'web3'
import styles from './Price.module.css'
export default function Price({
price,
2020-05-25 14:53:38 +02:00
className,
small
2020-05-07 08:03:30 +02:00
}: {
price: string
className?: string
2020-05-25 14:53:38 +02:00
small?: boolean
2020-05-07 08:03:30 +02:00
}) {
2020-05-25 14:53:38 +02:00
const classes = small
? `${styles.price} ${styles.small} ${className}`
: `${styles.price} ${className}`
2020-05-07 08:03:30 +02:00
const isFree = price === '0'
const displayPrice = isFree ? (
'Free'
) : (
<>
<span>OCEAN</span> {Web3.utils.fromWei(price)}
</>
)
return <div className={classes}>{displayPrice}</div>
}