mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-30 23:25:29 +01:00
Use DocLabel in input block
This commit is contained in:
parent
d9b458d7fd
commit
ba0a94f3ad
5 changed files with 21 additions and 4 deletions
|
@ -1,11 +1,13 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import input from '../../config/input'
|
import input from '../../config/input'
|
||||||
|
import DocLabel from '../fields/DocLabel'
|
||||||
import { margins } from '../../config/scales'
|
import { margins } from '../../config/scales'
|
||||||
|
|
||||||
/** Wrap a component with a label */
|
/** Wrap a component with a label */
|
||||||
class InputBlock extends React.Component {
|
class InputBlock extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
label: React.PropTypes.string.isRequired,
|
label: React.PropTypes.string.isRequired,
|
||||||
|
doc: React.PropTypes.string,
|
||||||
children: React.PropTypes.element.isRequired,
|
children: React.PropTypes.element.isRequired,
|
||||||
style: React.PropTypes.object,
|
style: React.PropTypes.object,
|
||||||
}
|
}
|
||||||
|
@ -31,6 +33,16 @@ class InputBlock extends React.Component {
|
||||||
...input.property,
|
...input.property,
|
||||||
...this.props.style,
|
...this.props.style,
|
||||||
}}>
|
}}>
|
||||||
|
{this.props.doc &&
|
||||||
|
<DocLabel
|
||||||
|
label={this.props.label}
|
||||||
|
doc={this.props.doc}
|
||||||
|
style={{
|
||||||
|
width: '50%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
{!this.props.doc &&
|
||||||
<label
|
<label
|
||||||
style={{
|
style={{
|
||||||
...input.label,
|
...input.label,
|
||||||
|
@ -38,6 +50,7 @@ class InputBlock extends React.Component {
|
||||||
}}>
|
}}>
|
||||||
{this.props.label}
|
{this.props.label}
|
||||||
</label>
|
</label>
|
||||||
|
}
|
||||||
{this.renderChildren()}
|
{this.renderChildren()}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
||||||
import InputBlock from '../inputs/InputBlock'
|
import InputBlock from '../inputs/InputBlock'
|
||||||
import StringInput from '../inputs/StringInput'
|
import StringInput from '../inputs/StringInput'
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ class LayerIdBlock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Layer ID"}>
|
return <InputBlock label={"Layer ID"} doc={GlSpec.layer.id.doc}>
|
||||||
<StringInput
|
<StringInput
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
||||||
import InputBlock from '../inputs/InputBlock'
|
import InputBlock from '../inputs/InputBlock'
|
||||||
import StringInput from '../inputs/StringInput'
|
import StringInput from '../inputs/StringInput'
|
||||||
import SelectInput from '../inputs/SelectInput'
|
import SelectInput from '../inputs/SelectInput'
|
||||||
|
@ -18,7 +19,7 @@ class LayerSourceBlock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Source"}>
|
return <InputBlock label={"Source"} doc={GlSpec.layer.source.doc}>
|
||||||
<AutocompleteInput
|
<AutocompleteInput
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
||||||
import InputBlock from '../inputs/InputBlock'
|
import InputBlock from '../inputs/InputBlock'
|
||||||
import StringInput from '../inputs/StringInput'
|
import StringInput from '../inputs/StringInput'
|
||||||
import SelectInput from '../inputs/SelectInput'
|
import SelectInput from '../inputs/SelectInput'
|
||||||
|
@ -18,7 +19,7 @@ class LayerSourceLayer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Source Layer"}>
|
return <InputBlock label={"Source Layer"} doc={GlSpec.layer['source-layer'].doc}>
|
||||||
<AutocompleteInput
|
<AutocompleteInput
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
||||||
import InputBlock from '../inputs/InputBlock'
|
import InputBlock from '../inputs/InputBlock'
|
||||||
import SelectInput from '../inputs/SelectInput'
|
import SelectInput from '../inputs/SelectInput'
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ class LayerTypeBlock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Layer Type"}>
|
return <InputBlock label={"Layer Type"} doc={GlSpec.layer.type.doc}>
|
||||||
<SelectInput
|
<SelectInput
|
||||||
options={[
|
options={[
|
||||||
['background', 'Background'],
|
['background', 'Background'],
|
||||||
|
|
Loading…
Reference in a new issue