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