mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-26 07:22:43 -05:00
32 lines
863 B
React
32 lines
863 B
React
|
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);
|