diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 564d1ba..0b94046 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -19,6 +19,7 @@ class Button extends React.Component { padding: margins[1], userSelect: 'none', borderRadius: 2, + boxSizing: 'border-box', ...this.props.style, }}> {this.props.children} diff --git a/src/components/filter/CombiningOperatorSelect.jsx b/src/components/filter/CombiningOperatorSelect.jsx deleted file mode 100644 index 83bae99..0000000 --- a/src/components/filter/CombiningOperatorSelect.jsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react' -import SelectInput from '../inputs/SelectInput' - -import input from '../../config/input.js' -import { margins } from '../../config/scales.js' -import { combiningFilterOps } from '../../libs/filterops.js' - -class CombiningOperatorSelect extends React.Component { - static propTypes = { - value: React.PropTypes.string.isRequired, - onChange: React.PropTypes.func.isRequired, - style: React.PropTypes.object, - } - - render() { - return
- - -
- } -} - -export default CombiningOperatorSelect diff --git a/src/components/filter/FilterEditor.jsx b/src/components/filter/FilterEditor.jsx index 4d635ff..a7fffe9 100644 --- a/src/components/filter/FilterEditor.jsx +++ b/src/components/filter/FilterEditor.jsx @@ -1,16 +1,15 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' 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 OperatorSelect from './OperatorSelect' -import SingleFilterEditor from './SingleFilterEditor' -import CombiningOperatorSelect from './CombiningOperatorSelect' -import FilterEditorBlock from './FilterEditorBlock' +import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' import DocLabel from '../fields/DocLabel' +import SelectInput from '../inputs/SelectInput' +import SingleFilterEditor from './SingleFilterEditor' +import FilterEditorBlock from './FilterEditorBlock' import Button from '../Button' import AddIcon from 'react-icons/lib/md/add-circle-outline' @@ -75,7 +74,7 @@ export default class CombiningFilterEditor extends React.Component { let combiningOp = filter[0] let filters = filter.slice(1) - const filterEditors = filters.map((f, idx) => { + const editorBlocks = filters.map((f, idx) => { return -
- + + + -
- -
- - {filterEditors} + {editorBlocks} } } diff --git a/src/components/filter/FilterEditorBlock.jsx b/src/components/filter/FilterEditorBlock.jsx index 5413175..7905906 100644 --- a/src/components/filter/FilterEditorBlock.jsx +++ b/src/components/filter/FilterEditorBlock.jsx @@ -8,21 +8,9 @@ class FilterEditorBlock extends React.Component { children: React.PropTypes.element.isRequired, } - renderChildren() { - return React.Children.map(this.props.children, child => { - return React.cloneElement(child, { - style: { - ...child.props.style, - display: 'inline-block', - width: '75%', - } - }) - }) - } - render() { return
-
+
- {this.props.children} +
+ {this.props.children} +
} } diff --git a/src/components/filter/OperatorSelect.jsx b/src/components/filter/OperatorSelect.jsx deleted file mode 100644 index 081b0da..0000000 --- a/src/components/filter/OperatorSelect.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import SelectInput from '../inputs/SelectInput' - -import { otherFilterOps } from '../../libs/filterops.js' -import { margins, fontSizes } from '../../config/scales.js' - -class OperatorSelect extends React.Component { - static propTypes = { - value: React.PropTypes.string.isRequired, - onChange: React.PropTypes.func.isRequired, - } - - render() { - return [op, op])} - /> - } -} - -export default OperatorSelect diff --git a/src/components/filter/SingleFilterEditor.jsx b/src/components/filter/SingleFilterEditor.jsx index 63b2aeb..2433ea6 100644 --- a/src/components/filter/SingleFilterEditor.jsx +++ b/src/components/filter/SingleFilterEditor.jsx @@ -1,9 +1,10 @@ import React from 'react' -import OperatorSelect from './OperatorSelect' import { margins, fontSizes } from '../../config/scales.js' +import { otherFilterOps } from '../../libs/filterops.js' import StringInput from '../inputs/StringInput' import AutocompleteInput from '../inputs/AutocompleteInput' +import SelectInput from '../inputs/SelectInput' class SingleFilterEditor extends React.Component { static propTypes = { @@ -35,21 +36,25 @@ class SingleFilterEditor extends React.Component { }}> [propName, propName])} onChange={newPropertyName => this.onFilterPartChanged(filterOp, newPropertyName, filterArgs)} /> - this.onFilterPartChanged(newFilterOp, propertyName, filterArgs)} + options={otherFilterOps} /> this.onFilterPartChanged(filterOp, propertyName, v.split(','))}