Skip to content
Snippets Groups Projects
Commit 6676826b authored by Tom Robinson's avatar Tom Robinson
Browse files

FilterPopover: tweak various behaviors

parent d355af00
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,7 @@ export class FieldValuesWidget extends Component {
<div
style={{
width: this.props.expand ? this.props.maxWidth : null,
minWidth: this.props.minWidth,
maxWidth: this.props.maxWidth,
}}
>
......
......@@ -52,10 +52,11 @@ export default class FilterPopover extends Component {
constructor(props: Props) {
super(props);
const filter = props.filter || [];
this.state = {
// $FlowFixMe
filter: props.filter || [],
showOperator: false,
filter: filter,
showOperator: filter[0] == null,
};
}
......@@ -108,8 +109,8 @@ export default class FilterPopover extends Component {
let { filter } = this.state;
if (filter[0] !== operator) {
filter = this._updateOperator(filter, operator);
this.setState({ filter, showOperator: false });
}
this.setState({ filter, showOperator: false });
};
setValue(index: number, value: any) {
......@@ -247,6 +248,8 @@ export default class FilterPopover extends Component {
searchField={field.filterSearchField()}
autoFocus={index === 0}
alwaysShowOptions={operator.fields.length === 1}
minWidth={440}
maxWidth={440}
/>
);
} else if (operatorField.type === "text") {
......@@ -339,7 +342,7 @@ export default class FilterPopover extends Component {
className="ml-auto flex align-center text-grey-3 pl4"
onClick={() => this.setState({ showOperator: !showOperator })}
>
<h3>{operator && operator.verboseName}</h3>
{!showOperator && <h3>{operator && operator.verboseName}</h3>}
<Icon
name={showOperator ? "chevronup" : "chevrondown"}
size={12}
......
......@@ -35,9 +35,12 @@ export default class OperatorSelector extends Component {
{operators.map(o => (
<button
key={o.name}
className={cx("Button Button-normal Button--medium mr1 mb1", {
"Button--purple": o.name === operator,
})}
className={cx(
"Button Button-normal Button--medium mr1 mb1 text-purple-hover",
{
"Button--purple": o.name === operator,
},
)}
onClick={() => this.props.onOperatorChange(o.name)}
>
{o.verboseName}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment