Просмотр исходного кода

Make search input stay opened if there's a value

This is applicable in the case where the search input can be toggled
opened and closed (i.e. in the replicas list).
Sergiu Miclea 8 лет назад
Родитель
Сommit
ec013bf5f4
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/components/molecules/SearchInput/index.jsx

+ 2 - 2
src/components/molecules/SearchInput/index.jsx

@@ -122,7 +122,7 @@ class SearchInput extends React.Component<Props, State> {
   render() {
     return (
       <Wrapper
-        open={this.state.open || this.props.alwaysOpen}
+        open={this.state.open || this.props.alwaysOpen || this.state.value !== ''}
         onMouseDown={() => { this.itemMouseDown = true }}
         onMouseUp={() => { this.itemMouseDown = false }}
         onMouseEnter={() => { this.handleMouseEnter() }}
@@ -144,7 +144,7 @@ class SearchInput extends React.Component<Props, State> {
           primary={
             this.state.open ||
             (this.props.alwaysOpen && (this.state.hover || this.state.focus)) ||
-            (!this.props.alwaysOpen && this.state.value !== '')
+            (this.state.value !== '' && (this.state.hover || this.state.focus))
           }
           onClick={() => { this.handleSearchButtonClick() }}
         />