Added UrlInput component to tidy things up a little.

This commit is contained in:
orangemug
2019-10-27 17:08:23 +00:00
parent 663f295623
commit 566201fb45
8 changed files with 126 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import {latest} from '@mapbox/mapbox-gl-style-spec'
import InputBlock from '../inputs/InputBlock'
import StringInput from '../inputs/StringInput'
import UrlInput from '../inputs/UrlInput'
import NumberInput from '../inputs/NumberInput'
import SelectInput from '../inputs/SelectInput'
import JSONEditor from '../layers/JSONEditor'
@@ -18,7 +19,7 @@ class TileJSONSourceEditor extends React.Component {
render() {
return <div>
<InputBlock label={"TileJSON URL"} doc={latest.source_vector.url.doc}>
<StringInput
<UrlInput
value={this.props.source.url}
onChange={url => this.props.onChange({
...this.props.source,
@@ -52,7 +53,7 @@ class TileURLSourceEditor extends React.Component {
const tiles = this.props.source.tiles || []
return tiles.map((tileUrl, tileIndex) => {
return <InputBlock key={tileIndex} label={prefix[tileIndex] + " Tile URL"} doc={latest.source_vector.tiles.doc}>
<StringInput
<UrlInput
value={tileUrl}
onChange={this.changeTileUrl.bind(this, tileIndex)}
/>