diff --git a/src/components/App.jsx b/src/components/App.jsx index e3ddf0d..bac49eb 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -239,6 +239,7 @@ export default class App extends React.Component { onLayerSelect={this.onLayerSelect.bind(this)} selectedLayerIndex={this.state.selectedLayerIndex} layers={layers} + sources={this.state.sources} /> const layerEditor = selectedLayer ? - Open {this.downloadButton()} - - - Add Layer - Sources diff --git a/src/components/inputs/AutocompleteInput.jsx b/src/components/inputs/AutocompleteInput.jsx index 6c03a30..c2b4c1f 100644 --- a/src/components/inputs/AutocompleteInput.jsx +++ b/src/components/inputs/AutocompleteInput.jsx @@ -16,8 +16,7 @@ class AutocompleteInput extends React.Component { } render() { - - const AutocompleteMenu = (items, value, style) =>
+ const AutocompleteMenu = (items, value, style) =>
return {}, } + constructor(props) { + super(props) + this.state = { + isOpen: { + add: false, + } + } + } + onLayerDestroy(layerId) { const remainingLayers = this.props.layers.slice(0) const idx = style.indexOfLayer(remainingLayers, layerId) @@ -53,6 +64,15 @@ class LayerListContainer extends React.Component { this.props.onLayersChange(changedLayers) } + toggleModal(modalName) { + this.setState({ + isOpen: { + ...this.state.isOpen, + [modalName]: !this.state.isOpen[modalName] + } + }) + } + render() { const layerPanels = this.props.layers.map((layer, index) => { const layerId = layer.id @@ -70,10 +90,21 @@ class LayerListContainer extends React.Component { /> }) return
+
Layers - +
    {layerPanels} diff --git a/src/components/modals/AddModal.jsx b/src/components/modals/AddModal.jsx index 8522d21..eb2dd7b 100644 --- a/src/components/modals/AddModal.jsx +++ b/src/components/modals/AddModal.jsx @@ -13,8 +13,8 @@ import LayerSourceLayerBlock from '../layers/LayerSourceLayerBlock' class AddModal extends React.Component { static propTypes = { - mapStyle: React.PropTypes.object.isRequired, - onStyleChange: React.PropTypes.func.isRequired, + layers: React.PropTypes.array.isRequired, + onLayersChange: React.PropTypes.func.isRequired, isOpen: React.PropTypes.bool.isRequired, onOpenToggle: React.PropTypes.func.isRequired, @@ -23,7 +23,7 @@ class AddModal extends React.Component { } addLayer() { - const changedLayers = this.props.mapStyle.layers.slice(0) + const changedLayers = this.props.layers.slice(0) const layer = { id: this.state.id, type: this.state.type, @@ -38,12 +38,7 @@ class AddModal extends React.Component { changedLayers.push(layer) - const changedStyle = { - ...this.props.mapStyle, - layers: changedLayers, - } - - this.props.onStyleChange(changedStyle) + this.props.onLayersChange(changedLayers) this.props.onOpenToggle(false) } diff --git a/src/styles/_layout.scss b/src/styles/_layout.scss index 463bfa4..9db9a1e 100644 --- a/src/styles/_layout.scss +++ b/src/styles/_layout.scss @@ -13,34 +13,35 @@ .maputnik-layout { font-family: $font-family; color: $color-white; -} -.maputnik-layout-list { - position: fixed; - bottom: 0px; - height: 100%; - top: 40px; - left: 0px; - z-index: 1; - width: 200px; - overflow: hidden; - background-color: $color-black; -} -.maputnik-layout-drawer { - position: fixed; - bottom: 0px; - height: 100%; - top: 40px; - left: 200px; - z-index: 1; - width: 350px; - background-color: $color-black; -} -.maputnik-layout-bottom { - position: fixed; - height: 50px; - bottom: 0px; - left: 550px; - z-index: 1; - width: 100%; - background-color: $color-black; + + &-list { + position: fixed; + bottom: 0px; + height: 100%; + top: 40px; + left: 0px; + z-index: 3; + width: 200px; + overflow: hidden; + background-color: $color-black; + } + &-drawer { + position: fixed; + bottom: 0px; + height: 100%; + top: 40px; + left: 200px; + z-index: 1; + width: 350px; + background-color: $color-black; + } + &-bottom { + position: fixed; + height: 50px; + bottom: 0px; + left: 550px; + z-index: 1; + width: 100%; + background-color: $color-black; + } }