Prevent CEO toggle from de-centering when no queries present

1.3.9.x
Alex P 2017-10-04 17:41:25 -07:00 committed by Nathan Haugo
parent 2c4637309c
commit ab5a4682c0
2 changed files with 11 additions and 11 deletions

View File

@ -16,13 +16,12 @@ const OverlayControls = ({
onClickDisplayOptions,
}) =>
<div className="overlay-controls">
{queries.length
? <SourceSelector
sources={sources}
selected={selected}
onSetQuerySource={onSetQuerySource}
/>
: null}
<SourceSelector
sources={sources}
selected={selected}
onSetQuerySource={onSetQuerySource}
queries={queries}
/>
<ul className="nav nav-tablist nav-tablist-sm">
<li
key="queries"

View File

@ -1,8 +1,8 @@
import React, {PropTypes} from 'react'
import Dropdown from 'shared/components/Dropdown'
const SourceSelector = ({sources = [], selected, onSetQuerySource}) =>
sources.length > 1
const SourceSelector = ({sources = [], selected, onSetQuerySource, queries}) =>
sources.length > 1 && queries.length
? <div className="source-selector">
<h3>Source:</h3>
<Dropdown
@ -15,14 +15,15 @@ const SourceSelector = ({sources = [], selected, onSetQuerySource}) =>
className="dropdown-240"
/>
</div>
: null
: <div className="source-selector" />
const {arrayOf, func, shape, string} = PropTypes
const {array, arrayOf, func, shape, string} = PropTypes
SourceSelector.propTypes = {
sources: arrayOf(shape()).isRequired,
onSetQuerySource: func.isRequired,
selected: string,
queries: array,
}
export default SourceSelector