Fixes to search dropdown

This commit is contained in:
kibigo!
2018-01-06 15:34:01 -08:00
parent 61ef8d643e
commit b5874c1428
4 changed files with 102 additions and 92 deletions

View File

@@ -45,10 +45,10 @@ const handlers = {
const {
onClear,
submitted,
value: { length },
value,
} = this.props;
e.preventDefault(); // Prevents focus change ??
if (onClear && (submitted || length)) {
if (onClear && (submitted || value && value.length)) {
onClear();
}
},
@@ -100,7 +100,8 @@ export default class DrawerSearch extends React.PureComponent {
value,
} = this.props;
const { expanded } = this.state;
const computedClass = classNames('drawer--search', { active: value.length || submitted });
const active = value && value.length || submitted;
const computedClass = classNames('drawer--search', { active });
return (
<div className={computedClass}>
@@ -126,11 +127,11 @@ export default class DrawerSearch extends React.PureComponent {
tabIndex='0'
>
<Icon icon='search' />
<Icon icon='fa-times-circle' />
<Icon icon='times-circle' />
</div>
<Overlay
placement='bottom'
show={expanded && !(value || '').length && !submitted}
show={expanded && !active}
target={this}
><DrawerSearchPopout /></Overlay>
</div>