mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-27 10:05:24 +01:00
Add string field
This commit is contained in:
parent
4d1609a826
commit
885e31111c
3 changed files with 31 additions and 0 deletions
|
@ -14,6 +14,7 @@ static propTypes = {
|
|||
return <Input
|
||||
label={this.props.name}
|
||||
name={this.props.name}
|
||||
value={this.props.value}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import GlSpec from 'mapbox-gl-style-spec/reference/latest.min.js'
|
|||
import NumberField from './number'
|
||||
import EnumField from './enum'
|
||||
import ColorField from './color'
|
||||
import StringField from './string'
|
||||
|
||||
class SpecField extends React.Component {
|
||||
static propTypes = {
|
||||
|
@ -37,6 +38,13 @@ class SpecField extends React.Component {
|
|||
doc={this.props.fieldSpec.doc}
|
||||
/>
|
||||
)
|
||||
case 'string': return (
|
||||
<StringField
|
||||
value={this.props.value}
|
||||
name={this.props.fieldName}
|
||||
doc={this.props.fieldSpec.doc}
|
||||
/>
|
||||
)
|
||||
case 'color': return (
|
||||
<ColorField
|
||||
value={this.props.value}
|
||||
|
|
22
src/fields/string.jsx
Normal file
22
src/fields/string.jsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import React from 'react'
|
||||
import { Input } from 'rebass'
|
||||
|
||||
/*** Number fields with support for min, max and units and documentation*/
|
||||
class StringField extends React.Component {
|
||||
static propTypes = {
|
||||
name: React.PropTypes.string.isRequired,
|
||||
value: React.PropTypes.number,
|
||||
default: React.PropTypes.number,
|
||||
doc: React.PropTypes.string,
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Input
|
||||
label={this.props.name}
|
||||
name={this.props.name}
|
||||
value={this.props.value}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
export default StringField
|
Loading…
Reference in a new issue