Example how to display fields from spec

This commit is contained in:
lukasmartinelli
2016-09-10 22:58:15 +02:00
parent 890169751b
commit 61d24fdb2b
4 changed files with 59 additions and 4 deletions

18
src/fields/enum.jsx Normal file
View File

@@ -0,0 +1,18 @@
import React from 'react'
import { Select, Input } from 'rebass'
export default class EnumField extends React.Component {
static propTypes = {
name: React.PropTypes.string.isRequired,
values: React.PropTypes.array.isRequired,
value: React.PropTypes.string.isRequired,
doc: React.PropTypes.string,
}
render() {
const options = this.props.values.map(val => {
return {children: val, value: val}
})
return <Select name={this.props.name} options={options} label={this.props.name} />
}
}