import numeral from 'numeral' import { useState } from 'react' import { Card } from '@components/tailwind/Card' import { Grid } from '@components/tailwind/Grid' export const Stats = ({ bridgeVolume, transactions, addresses, setChartType, allTime, }) => { const [activeState, setState] = useState('VOLUME') const updateState = (string) => { setState(string) setChartType(string) } if (allTime) { return ( updateState('VOLUME')} >
{numeral(bridgeVolume / 1000000000).format('$0.000')}B
updateState('TRANSACTIONS')} >
{numeral(transactions).format('0,0')}
updateState('ADDRESSES')} >
{numeral(addresses).format('0,0')}
) } else { return ( updateState('VOLUME')} >
{numeral(bridgeVolume / 1000000).format('$0.000')}M
updateState('TRANSACTIONS')} >
{numeral(transactions).format('0,0')}
updateState('ADDRESSES')} >
{numeral(addresses).format('0,0')}
) } } export const StatCard = ({ onClick, title, children, active = false, duration = '30-day', }) => { const activeClass = active ? 'opacity-100' : 'opacity-20 hover:opacity-100' return (
{title}
{children}
{duration}
) } export const AllTimeStatCard = ({ onClick, title, children, active = false, duration = 'All-Time', }) => { const activeClass = active ? 'opacity-100' : 'opacity-20 hover:opacity-100' return (
{title}
{children}
{duration}
) }