Various UI Fixes and Updates

Closes #188
Closes #185
Closes #187
This commit is contained in:
Qstick 2018-01-25 22:01:53 -05:00
parent 3beac03c00
commit 54e9f88648
89 changed files with 2354 additions and 995 deletions

View file

@ -8,12 +8,23 @@ class NumberInput extends Component {
// Listeners
onChange = ({ name, value }) => {
const {
min,
max
} = this.props;
let newValue = null;
if (value) {
newValue = this.props.isFloat ? parseFloat(value) : parseInt(value);
}
if (min != null && newValue < min) {
newValue = min;
} else if (max != null && newValue > max) {
newValue = max;
}
this.props.onChange({
name,
value: newValue
@ -40,6 +51,8 @@ class NumberInput extends Component {
NumberInput.propTypes = {
value: PropTypes.number,
min: PropTypes.number,
max: PropTypes.number,
isFloat: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired
};