فهرست منبع

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 سال پیش
والد
کامیت
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() {
   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() }}
         />
         />