Procházet zdrojové kódy

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 před 8 roky
rodič
revize
ec013bf5f4
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  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() {
   render() {
     return (
     return (
       <Wrapper
       <Wrapper
-        open={this.state.open || this.props.alwaysOpen}
+        open={this.state.open || this.props.alwaysOpen || this.state.value !== ''}
         onMouseDown={() => { this.itemMouseDown = true }}
         onMouseDown={() => { this.itemMouseDown = true }}
         onMouseUp={() => { this.itemMouseDown = false }}
         onMouseUp={() => { this.itemMouseDown = false }}
         onMouseEnter={() => { this.handleMouseEnter() }}
         onMouseEnter={() => { this.handleMouseEnter() }}
@@ -144,7 +144,7 @@ class SearchInput extends React.Component<Props, State> {
           primary={
           primary={
             this.state.open ||
             this.state.open ||
             (this.props.alwaysOpen && (this.state.hover || this.state.focus)) ||
             (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() }}
           onClick={() => { this.handleSearchButtonClick() }}
         />
         />