scratch-paint/src/components/stroke-width-indicator.jsx

32 lines
947 B
React
Raw Normal View History

2017-09-08 11:52:36 -04:00
import React from 'react';
import PropTypes from 'prop-types';
import BufferedInputHOC from './forms/buffered-input-hoc.jsx';
import Input from './forms/input.jsx';
import InputGroup from './input-group/input-group.jsx';
2017-09-08 11:52:36 -04:00
import {MAX_STROKE_WIDTH} from '../reducers/stroke-width';
const BufferedInput = BufferedInputHOC(Input);
const StrokeWidthIndicatorComponent = props => (
<InputGroup disabled={props.disabled}>
2017-09-08 11:52:36 -04:00
<BufferedInput
small
2017-10-26 18:16:14 -04:00
disabled={props.disabled}
2017-09-08 11:52:36 -04:00
max={MAX_STROKE_WIDTH}
min="0"
type="number"
value={props.strokeWidth ? props.strokeWidth : 0}
2017-09-08 11:52:36 -04:00
onSubmit={props.onChangeStrokeWidth}
/>
</InputGroup>
2017-09-08 11:52:36 -04:00
);
StrokeWidthIndicatorComponent.propTypes = {
2017-10-26 18:16:14 -04:00
disabled: PropTypes.bool.isRequired,
2017-09-08 11:52:36 -04:00
onChangeStrokeWidth: PropTypes.func.isRequired,
strokeWidth: PropTypes.number
2017-09-08 11:52:36 -04:00
};
export default StrokeWidthIndicatorComponent;