maputnik/src/components/layers/LayerSourceBlock.jsx

33 lines
861 B
React
Raw Normal View History

import React from 'react'
2017-01-09 16:45:59 +01:00
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
import InputBlock from '../inputs/InputBlock'
import StringInput from '../inputs/StringInput'
import SelectInput from '../inputs/SelectInput'
import AutocompleteInput from '../inputs/AutocompleteInput'
class LayerSourceBlock extends React.Component {
static propTypes = {
2016-12-31 10:39:30 +01:00
value: React.PropTypes.string,
onChange: React.PropTypes.func,
sourceIds: React.PropTypes.array,
}
static defaultProps = {
onChange: () => {},
sourceIds: [],
}
render() {
2017-01-09 16:45:59 +01:00
return <InputBlock label={"Source"} doc={GlSpec.layer.source.doc}>
<AutocompleteInput
value={this.props.value}
onChange={this.props.onChange}
options={this.props.sourceIds.map(src => [src, src])}
/>
</InputBlock>
}
}
export default LayerSourceBlock