import React, {Component} from 'react'; import translate from 'translations'; import PropTypes from 'prop-types'; export default class CurrentRates extends Component { constructor(props) { super(props); this.state = { ETHBTCAmount: 1, ETHREPAmount: 1, BTCETHAmount: 1, BTCREPAmount: 1 } } static propTypes = { ETHBTC: PropTypes.number, ETHREP: PropTypes.number, BTCETH: PropTypes.number, BTCREP: PropTypes.number }; onChange = (event) => { const target = event.target; const value = target.value; const name = target.name; this.setState({ [name]: value }); }; // TODO - A little code duplication here, but simple enough to where it doesn't seem worth the time to fix. render() { return (
{translate('SWAP_rates')}

ETH = {(this.state.ETHBTCAmount * this.props.ETHBTC).toFixed(6)} BTC

ETH = {(this.state.ETHREPAmount * this.props.ETHREP).toFixed(6)} REP

BTC = {(this.state.BTCETHAmount * this.props.BTCETH).toFixed(6)} ETH

BTC = {(this.state.BTCREPAmount * this.props.BTCREP).toFixed(6)} REP

) } }