From 9e4c510372be5d3444b798a469778e44cb3f486b Mon Sep 17 00:00:00 2001 From: DD Date: Thu, 7 Sep 2017 17:12:50 -0400 Subject: [PATCH 1/7] add fill color component --- src/components/fill-color-indicator.jsx | 38 ++++++++++++++++++++ src/components/paint-editor.jsx | 11 ++---- src/containers/fill-color-indicator.jsx | 31 ++++++++++++++++ src/reducers/fill-color.js | 33 +++++++++++++++++ src/reducers/scratch-paint-reducer.js | 4 ++- test/unit/fill-color-reducer.test.js | 48 +++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 src/components/fill-color-indicator.jsx create mode 100644 src/containers/fill-color-indicator.jsx create mode 100644 src/reducers/fill-color.js create mode 100644 test/unit/fill-color-reducer.test.js diff --git a/src/components/fill-color-indicator.jsx b/src/components/fill-color-indicator.jsx new file mode 100644 index 00000000..7a526d58 --- /dev/null +++ b/src/components/fill-color-indicator.jsx @@ -0,0 +1,38 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import {defineMessages, injectIntl, intlShape} from 'react-intl'; +import BufferedInputHOC from './forms/buffered-input-hoc.jsx'; +import Label from './forms/label.jsx'; +import Input from './forms/input.jsx'; + +import styles from './paint-editor.css'; + +const BufferedInput = BufferedInputHOC(Input); +const messages = defineMessages({ + fill: { + id: 'paint.paintEditor.fill', + description: 'Label for the color picker for the fill color', + defaultMessage: 'Fill' + } +}); +const FillColorIndicatorComponent = props => ( +
+ +
+); + +FillColorIndicatorComponent.propTypes = { + fillColor: PropTypes.string.isRequired, + intl: intlShape, + onChangeFillColor: PropTypes.func.isRequired +}; + +export default injectIntl(FillColorIndicatorComponent); diff --git a/src/components/paint-editor.jsx b/src/components/paint-editor.jsx index 4b482f5d..8558a140 100644 --- a/src/components/paint-editor.jsx +++ b/src/components/paint-editor.jsx @@ -5,6 +5,7 @@ import BrushMode from '../containers/brush-mode.jsx'; import EraserMode from '../containers/eraser-mode.jsx'; import PropTypes from 'prop-types'; import LineMode from '../containers/line-mode.jsx'; +import FillColorIndicatorComponent from '../containers/fill-color-indicator.jsx'; import {defineMessages, injectIntl, intlShape} from 'react-intl'; import BufferedInputHOC from './forms/buffered-input-hoc.jsx'; @@ -107,15 +108,7 @@ class PaintEditorComponent extends React.Component { {/* Second Row */}
{/* To be fill */} -
- -
+ {/* To be stroke */}