blowfish/src/app/components/Balance.jsx

31 lines
775 B
React
Raw Normal View History

import React, { PureComponent } from 'react'
2019-05-06 00:10:28 +02:00
import PropTypes from 'prop-types'
2019-05-11 21:56:33 +02:00
import posed, { PoseGroup } from 'react-pose'
import { AppContext } from '../store/createContext'
import { cryptoFormatter } from '../../utils'
import './Balance.css'
2019-05-11 21:56:33 +02:00
import { fadeIn } from './Animations'
const Animation = posed.h1(fadeIn)
2019-05-06 00:10:28 +02:00
export default class Balance extends PureComponent {
static contextType = AppContext
static propTypes = {
balance: PropTypes.object.isRequired
}
render() {
const { currency } = this.context
const { balance } = this.props
return (
2019-05-11 21:56:33 +02:00
<PoseGroup animateOnMount>
<Animation key={currency} className="number">
{cryptoFormatter(balance[currency], currency)}
2019-05-11 21:56:33 +02:00
</Animation>
</PoseGroup>
)
}
2019-05-06 00:10:28 +02:00
}