maputnik/src/fields/color.jsx

29 lines
654 B
React
Raw Normal View History

2016-09-12 19:47:28 +02:00
import React from 'react'
import { Select, Input } from 'rebass'
/*** Number fields with support for min, max and units and documentation*/
class ColorField extends React.Component {
static propTypes = {
onChange: React.PropTypes.func.isRequired,
2016-09-12 19:47:28 +02:00
name: React.PropTypes.string.isRequired,
value: React.PropTypes.number,
default: React.PropTypes.number,
doc: React.PropTypes.string,
}
2016-09-12 20:29:53 +02:00
onChange(e) {
return this.props.onChange(e.target.value)
}
2016-09-12 19:47:28 +02:00
render() {
return <Input
2016-09-12 20:29:53 +02:00
onChange={this.onChange.bind(this)}
2016-09-12 19:47:28 +02:00
label={this.props.name}
name={this.props.name}
2016-09-12 19:54:02 +02:00
value={this.props.value}
2016-09-12 19:47:28 +02:00
/>
}
}
export default ColorField