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>
|
|
|
|
}
|