You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
659 B
28 lines
659 B
6 years ago
|
import { connect } from 'react-redux'
|
||
|
import CurrencyInput from './currency-input.component'
|
||
|
import { ETH } from '../../constants/common'
|
||
|
|
||
|
const mapStateToProps = state => {
|
||
|
const { metamask: { currentCurrency, conversionRate } } = state
|
||
|
|
||
|
return {
|
||
|
currentCurrency,
|
||
|
conversionRate,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
||
|
const { currentCurrency } = stateProps
|
||
|
const { useFiat } = ownProps
|
||
|
const suffix = useFiat ? currentCurrency.toUpperCase() : ETH
|
||
|
|
||
|
return {
|
||
|
...stateProps,
|
||
|
...dispatchProps,
|
||
|
...ownProps,
|
||
|
suffix,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default connect(mapStateToProps, null, mergeProps)(CurrencyInput)
|