mirror of
https://github.com/maputnik/editor.git
synced 2025-12-28 09:00:02 +00:00
Example how to display fields from spec
This commit is contained in:
18
src/fields/enum.jsx
Normal file
18
src/fields/enum.jsx
Normal 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} />
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user