scratch-paint/src/components/paint-editor.jsx

30 lines
872 B
React
Raw Normal View History

import PropTypes from 'prop-types';
2017-07-13 14:03:48 -04:00
import React from 'react';
import PaperCanvas from '../containers/paper-canvas.jsx';
2017-07-20 22:48:07 -04:00
import BrushTool from '../containers/tools/brush-tool.jsx';
2017-07-25 11:53:54 -04:00
import EraserTool from '../containers/tools/eraser-tool.jsx';
2017-07-27 00:34:33 -04:00
import ToolTypes from '../tools/tool-types.js';
2017-07-13 14:03:48 -04:00
2017-07-27 11:45:41 -04:00
class PaintEditorComponent extends React.Component {
render () {
return (
<div>
<PaperCanvas
ref={canvas => {
this.canvas = canvas;
}}
tool={this.props.tool}
/>
<BrushTool canvas={this.canvas} />
<EraserTool canvas={this.canvas} />
</div>
);
}
}
2017-07-13 14:03:48 -04:00
PaintEditorComponent.propTypes = {
2017-07-27 00:34:33 -04:00
tool: PropTypes.oneOf(Object.keys(ToolTypes)).isRequired
2017-07-13 14:03:48 -04:00
};
2017-07-26 20:39:12 -04:00
export default PaintEditorComponent;