diff options
Diffstat (limited to 'src/components/ui/SearchInput.js')
-rw-r--r-- | src/components/ui/SearchInput.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/components/ui/SearchInput.js b/src/components/ui/SearchInput.js index 5a9571d27..78d6aae8b 100644 --- a/src/components/ui/SearchInput.js +++ b/src/components/ui/SearchInput.js | |||
@@ -2,7 +2,6 @@ import React, { Component } from 'react'; | |||
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import classnames from 'classnames'; | 4 | import classnames from 'classnames'; |
5 | import uuidv1 from 'uuid/v1'; | ||
6 | import { debounce } from 'lodash'; | 5 | import { debounce } from 'lodash'; |
7 | 6 | ||
8 | export default @observer class SearchInput extends Component { | 7 | export default @observer class SearchInput extends Component { |
@@ -22,7 +21,7 @@ export default @observer class SearchInput extends Component { | |||
22 | value: '', | 21 | value: '', |
23 | placeholder: '', | 22 | placeholder: '', |
24 | className: '', | 23 | className: '', |
25 | name: uuidv1(), | 24 | name: 'searchInput', |
26 | throttle: false, | 25 | throttle: false, |
27 | throttleDelay: 250, | 26 | throttleDelay: 250, |
28 | onChange: () => null, | 27 | onChange: () => null, |
@@ -30,6 +29,8 @@ export default @observer class SearchInput extends Component { | |||
30 | autoFocus: false, | 29 | autoFocus: false, |
31 | } | 30 | } |
32 | 31 | ||
32 | input = null; | ||
33 | |||
33 | constructor(props) { | 34 | constructor(props) { |
34 | super(props); | 35 | super(props); |
35 | 36 | ||
@@ -74,8 +75,6 @@ export default @observer class SearchInput extends Component { | |||
74 | onReset(); | 75 | onReset(); |
75 | } | 76 | } |
76 | 77 | ||
77 | input = null; | ||
78 | |||
79 | render() { | 78 | render() { |
80 | const { className, name, placeholder } = this.props; | 79 | const { className, name, placeholder } = this.props; |
81 | const { value } = this.state; | 80 | const { value } = this.state; |
@@ -90,15 +89,17 @@ export default @observer class SearchInput extends Component { | |||
90 | <label | 89 | <label |
91 | htmlFor={name} | 90 | htmlFor={name} |
92 | className="mdi mdi-magnify" | 91 | className="mdi mdi-magnify" |
93 | /> | 92 | > |
94 | <input | 93 | <input |
95 | name={name} | 94 | name={name} |
96 | type="text" | 95 | id={name} |
97 | placeholder={placeholder} | 96 | type="text" |
98 | value={value} | 97 | placeholder={placeholder} |
99 | onChange={e => this.onChange(e)} | 98 | value={value} |
100 | ref={(ref) => { this.input = ref; }} | 99 | onChange={e => this.onChange(e)} |
101 | /> | 100 | ref={(ref) => { this.input = ref; }} |
101 | /> | ||
102 | </label> | ||
102 | {value.length > 0 && ( | 103 | {value.length > 0 && ( |
103 | <span | 104 | <span |
104 | className="mdi mdi-close-circle-outline" | 105 | className="mdi mdi-close-circle-outline" |