From b51354ae1dc0e6c0d72dc9b76e99791f63ba5ac8 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Wed, 11 Jan 2017 11:35:33 +0100 Subject: [PATCH] All important stuff is in CSS now --- src/components/fields/DocLabel.jsx | 5 +- src/components/fields/ZoomSpecField.jsx | 147 ++++++++----------- src/components/filter/FilterEditor.jsx | 31 +--- src/components/filter/FilterEditorBlock.jsx | 6 +- src/components/filter/SingleFilterEditor.jsx | 9 +- src/components/inputs/CheckboxInput.jsx | 53 +------ src/components/inputs/InputBlock.jsx | 11 +- src/components/inputs/SelectInput.jsx | 5 +- src/components/layers/LayerEditor.jsx | 9 +- src/components/layers/LayerEditorGroup.jsx | 3 - src/components/map/FeatureLayerPopup.jsx | 29 +--- src/components/map/FeaturePropertyPopup.jsx | 18 +-- src/components/modals/AddModal.jsx | 2 + src/components/modals/SettingsModal.jsx | 1 - src/components/modals/SourcesModal.jsx | 99 +++++-------- src/styles/_base.scss | 18 ++- src/styles/_components.scss | 12 ++ src/styles/_input.scss | 101 +++++++++++++ src/styles/_layer.scss | 100 ++++++++++++- src/styles/_modal.scss | 65 ++++++++ src/styles/_popup.scss | 28 ++++ src/styles/index.scss | 1 + 22 files changed, 452 insertions(+), 301 deletions(-) create mode 100644 src/styles/_popup.scss diff --git a/src/components/fields/DocLabel.jsx b/src/components/fields/DocLabel.jsx index ff6cde0..6f7c872 100644 --- a/src/components/fields/DocLabel.jsx +++ b/src/components/fields/DocLabel.jsx @@ -30,10 +30,7 @@ export default class DocLabel extends React.Component { onMouseOver={e => this.setState({showDoc: true})} onMouseOut={e => this.setState({showDoc: false})} className="maputnik-doc-target" - style={{ - cursor: 'help', - ...this.props.cursorTargetStyle, - }} + style={this.props.cursorTargetStyle} > {this.props.label} diff --git a/src/components/fields/ZoomSpecField.jsx b/src/components/fields/ZoomSpecField.jsx index 2fe6ea8..a080240 100644 --- a/src/components/fields/ZoomSpecField.jsx +++ b/src/components/fields/ZoomSpecField.jsx @@ -13,7 +13,6 @@ import FunctionIcon from 'react-icons/lib/md/functions' import capitalize from 'lodash.capitalize' import input from '../../config/input.js' import colors from '../../config/colors.js' -import { margins, fontSizes } from '../../config/scales.js' function isZoomField(value) { return typeof value === 'object' && value.stops @@ -22,7 +21,7 @@ function isZoomField(value) { /** Supports displaying spec field for zoom function objects * https://www.mapbox.com/mapbox-gl-style-spec/#types-function-zoom-property */ -export default class ZoomSpecField extends React.Component { +export default class ZoomSpecProperty extends React.Component { static propTypes = { onChange: React.PropTypes.func.isRequired, fieldName: React.PropTypes.string.isRequired, @@ -85,114 +84,90 @@ export default class ZoomSpecField extends React.Component { this.props.onChange(this.props.fieldName, changedValue) } - render() { - if(isZoomField(this.props.value)) { - let label = + + - const zoomFields = this.props.value.stops.map((stop, idx) => { - label = 0 ? "" : labelFromFieldName(this.props.fieldName)} - /> + const zoomFields = this.props.value.stops.map((stop, idx) => { + const zoomLevel = stop[0] + const value = stop[1] - if(idx === 1) { - label = - } + return
+ {label} + + +
this.changeStop(idx, changedStop, value)} min={0} max={22} /> +
+
this.changeStop(idx, zoomLevel, newValue)} - style={{ - width: '41%', - marginLeft: '1.5%', - }} />
- }) - - return
- {zoomFields}
- } else { + }) - if(this.props.fieldSpec['zoom-function']) { + return
+ {zoomFields} + +
+ } - } - - return
+ renderProperty() { + return
+ + {this.props.fieldSpec['zoom-function'] && + - } - -
+ + } + +
+ } + + render() { + if(isZoomField(this.props.value)) { + return this.renderZoomProperty(); + } else { + return this.renderProperty(); } } } diff --git a/src/components/filter/FilterEditor.jsx b/src/components/filter/FilterEditor.jsx index a815ced..fcfe7d8 100644 --- a/src/components/filter/FilterEditor.jsx +++ b/src/components/filter/FilterEditor.jsx @@ -1,8 +1,4 @@ import React from 'react' - -import input from '../../config/input.js' -import colors from '../../config/colors.js' -import { margins, fontSizes } from '../../config/scales.js' import { combiningFilterOps } from '../../libs/filterops.js' import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' @@ -86,41 +82,28 @@ export default class CombiningFilterEditor extends React.Component { //TODO: Implement support for nested filter if(hasNestedCombiningFilter(filter)) { - return
+ return
Nested filters are not supported.
} - return
-
+ return
+
{editorBlocks} -
-
diff --git a/src/components/filter/FilterEditorBlock.jsx b/src/components/filter/FilterEditorBlock.jsx index 4992618..8395b72 100644 --- a/src/components/filter/FilterEditorBlock.jsx +++ b/src/components/filter/FilterEditorBlock.jsx @@ -10,15 +10,15 @@ class FilterEditorBlock extends React.Component { render() { return
-
+
-
+
{this.props.children}
diff --git a/src/components/filter/SingleFilterEditor.jsx b/src/components/filter/SingleFilterEditor.jsx index 94c3244..f852534 100644 --- a/src/components/filter/SingleFilterEditor.jsx +++ b/src/components/filter/SingleFilterEditor.jsx @@ -1,6 +1,5 @@ import React from 'react' -import { margins, fontSizes } from '../../config/scales.js' import { otherFilterOps } from '../../libs/filterops.js' import StringInput from '../inputs/StringInput' import AutocompleteInput from '../inputs/AutocompleteInput' @@ -11,7 +10,6 @@ class SingleFilterEditor extends React.Component { filter: React.PropTypes.array.isRequired, onChange: React.PropTypes.func.isRequired, properties: React.PropTypes.object, - style: React.PropTypes.object, } static defaultProps = { @@ -29,12 +27,7 @@ class SingleFilterEditor extends React.Component { const propertyName = f[1] const filterArgs = f.slice(2) - return
+ return
+ return