mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-03-14 14:02:56 +01:00
- Moved all components into a single directory like nextjs - Made component names consistent with each other - Made component names consistent with their export class names - Added storybook for a few components with the aim to extend this further.
37 lines
859 B
JavaScript
37 lines
859 B
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
|
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
|
import Block from './Block'
|
|
import FieldAutocomplete from './FieldAutocomplete'
|
|
|
|
export default class BlockSource extends React.Component {
|
|
static propTypes = {
|
|
value: PropTypes.string,
|
|
wdKey: PropTypes.string,
|
|
onChange: PropTypes.func,
|
|
sourceIds: PropTypes.array,
|
|
error: PropTypes.object,
|
|
}
|
|
|
|
static defaultProps = {
|
|
onChange: () => {},
|
|
sourceIds: [],
|
|
}
|
|
|
|
render() {
|
|
return <Block
|
|
label={"Source"}
|
|
fieldSpec={latest.layer.source}
|
|
error={this.props.error}
|
|
data-wd-key={this.props.wdKey}
|
|
>
|
|
<FieldAutocomplete
|
|
value={this.props.value}
|
|
onChange={this.props.onChange}
|
|
options={this.props.sourceIds.map(src => [src, src])}
|
|
/>
|
|
</Block>
|
|
}
|
|
}
|
|
|