diff --git a/src/components/forms/input.css b/src/components/forms/input.css index 6fba0c59..69aea730 100644 --- a/src/components/forms/input.css +++ b/src/components/forms/input.css @@ -2,6 +2,10 @@ @todo This file is copied from GUI and should be pulled out into a shared library. See https://github.com/LLK/scratch-paint/issues/13 */ +/* NOTE: +Edited to add input-range-small +*/ + @import "../../css/units.css"; @import "../../css/colors.css"; @@ -44,3 +48,8 @@ See https://github.com/LLK/scratch-paint/issues/13 */ width: 3rem; text-align: center; } + +.input-small-range { + width: 3.75rem; + text-align: center; +} \ No newline at end of file diff --git a/src/components/forms/input.jsx b/src/components/forms/input.jsx index 95b46354..3a5feb13 100644 --- a/src/components/forms/input.jsx +++ b/src/components/forms/input.jsx @@ -2,6 +2,10 @@ @todo This file is copied from GUI and should be pulled out into a shared library. See https://github.com/LLK/scratch-paint/issues/13 */ +/* NOTE: +Edited to add range prop +*/ + import PropTypes from 'prop-types'; import React from 'react'; import classNames from 'classnames'; @@ -9,7 +13,7 @@ import classNames from 'classnames'; import styles from './input.css'; const Input = props => { - const {small, ...componentProps} = props; + const {small, range, ...componentProps} = props; return ( <input {...componentProps} @@ -17,7 +21,8 @@ const Input = props => { styles.inputForm, props.className, { - [styles.inputSmall]: small + [styles.inputSmall]: small && !range, + [styles.inputSmallRange]: small && range } )} /> @@ -26,10 +31,12 @@ const Input = props => { Input.propTypes = { className: PropTypes.string, + range: PropTypes.bool, small: PropTypes.bool }; Input.defaultProps = { + range: false, small: false }; diff --git a/src/components/mode-tools/mode-tools.css b/src/components/mode-tools/mode-tools.css index e053bd9a..f4a91033 100644 --- a/src/components/mode-tools/mode-tools.css +++ b/src/components/mode-tools/mode-tools.css @@ -20,4 +20,4 @@ .mod-labeled-icon-height { height: 2.85rem; /* for the second row so the dashed borders are equal in size */ -} +} \ No newline at end of file diff --git a/src/components/mode-tools/mode-tools.jsx b/src/components/mode-tools/mode-tools.jsx index 707626a2..a9522aa1 100644 --- a/src/components/mode-tools/mode-tools.jsx +++ b/src/components/mode-tools/mode-tools.jsx @@ -84,6 +84,8 @@ const ModeToolsComponent = props => { /> </div> <LiveInput + range + small max={MAX_STROKE_WIDTH} min="1" type="number" @@ -103,6 +105,8 @@ const ModeToolsComponent = props => { /> </div> <LiveInput + range + small max={MAX_STROKE_WIDTH} min="1" type="number" diff --git a/src/components/stroke-width-indicator.jsx b/src/components/stroke-width-indicator.jsx index 56aa846e..99b2d9d3 100644 --- a/src/components/stroke-width-indicator.jsx +++ b/src/components/stroke-width-indicator.jsx @@ -11,6 +11,8 @@ const LiveInput = LiveInputHOC(Input); const StrokeWidthIndicatorComponent = props => ( <InputGroup disabled={props.disabled}> <LiveInput + range + small disabled={props.disabled} max={MAX_STROKE_WIDTH} min="0"