import React from "react"; import { connect } from "react-redux"; import { setBalance } from "../actionCreators"; import { SET_FOCUS, UNSET_FOCUS } from "../actionTypes"; const offsetFromBalance = balance => { const percent = Math.abs(balance) / 100; const sprite = Math.round(percent * 28); const offset = (sprite - 1) * 15; return offset; }; const Balance = ({ balance, handleChange, showMarquee, hideMarquee }) => ( ); const mapStateToProps = state => state.media; const mapDispatchToProps = dispatch => ({ handleChange: e => dispatch(setBalance(e.target.value)), showMarquee: () => dispatch({ type: SET_FOCUS, input: "balance" }), hideMarquee: () => dispatch({ type: UNSET_FOCUS }) }); export default connect(mapStateToProps, mapDispatchToProps)(Balance);