scratch-paint/src/containers/fill-color-indicator.jsx

32 lines
863 B
React
Raw Normal View History

2017-09-07 17:12:50 -04:00
import PropTypes from 'prop-types';
import React from 'react';
import {connect} from 'react-redux';
import {changeFillColor} from '../reducers/fill-color';
import FillColorIndicatorComponent from '../components/fill-color-indicator.jsx';
const FillColorIndicator = props => (
<FillColorIndicatorComponent
fillColor={props.fillColor}
onChangeFillColor={props.handleChangeFillColor}
/>
);
FillColorIndicator.propTypes = {
fillColor: PropTypes.string.isRequired,
handleChangeFillColor: PropTypes.func.isRequired
};
const mapStateToProps = state => ({
fillColor: state.scratchPaint.fillColor
});
const mapDispatchToProps = dispatch => ({
handleChangeFillColor: fillColor => {
dispatch(changeFillColor(fillColor));
}
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(FillColorIndicator);