Rename to mapital

This commit is contained in:
lukasmartinelli
2016-09-19 15:06:34 +02:00
parent 9c6eb50343
commit 0cf37e6cd2
10 changed files with 30 additions and 13 deletions

View File

@@ -12,7 +12,8 @@ static propTypes = {
}
onChange(e) {
return this.props.onChange(e.target.value)
const value = e.target.value
return this.props.onChange(value === "" ? null: value)
}
render() {
@@ -22,7 +23,7 @@ static propTypes = {
style={inputStyle.input}
name={this.props.name}
placeholder={this.props.default}
value={this.props.value}
value={this.props.value ? this.props.value : ""}
onChange={this.onChange.bind(this)}
/>
</div>

View File

@@ -15,7 +15,12 @@ class NumberField extends React.Component {
}
onChange(e) {
return this.props.onChange(parseFloat(e.target.value))
const value = parseFloat(e.target.value)
/*TODO: we can do range validation already here?
if(this.props.min && value < this.props.min) return
if(this.props.max && value > this.props.max) return
*/
this.props.onChange(value)
}
render() {

View File

@@ -12,7 +12,8 @@ static propTypes = {
}
onChange(e) {
return this.props.onChange(e.target.value)
const value = e.target.value
return this.props.onChange(value === "" ? null: value)
}
render() {