Skip to content

Commit 36f88db

Browse files
author
Emmanouil Konstantinidis
committed
Simplify Search component
1 parent 84dd339 commit 36f88db

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/js/components/search.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export class SearchBar extends React.Component {
1212
}
1313

1414
render() {
15+
if (!this.props.showSearch) {
16+
return null;
17+
}
18+
1519
var clearSearchIcon;
1620

1721
if (this.props.query) {
@@ -21,22 +25,21 @@ export class SearchBar extends React.Component {
2125
}
2226

2327
return (
24-
<div className={this.props.showSearch ? 'container-fluid search-bar' : 'container-fluid' }>
25-
{this.props.showSearch ? (
26-
<div className="row">
27-
<div className="col-xs-10">
28-
<div className="form-group search-wrapper">
29-
<input
30-
autoFocus
31-
value={this.props.query}
32-
onChange={(evt) => this.props.searchNotifications(evt.target.value)}
33-
className="form-control"
34-
type="text"
35-
placeholder=" Search..." />
36-
</div>
28+
<div className="container-fluid search-bar">
29+
<div className="row">
30+
<div className="col-xs-10">
31+
<div className="form-group search-wrapper">
32+
<input
33+
autoFocus
34+
value={this.props.query}
35+
onChange={(evt) => this.props.searchNotifications(evt.target.value)}
36+
className="form-control"
37+
type="text"
38+
placeholder=" Search..." />
39+
</div>
3740
</div>
3841
<div className="col-xs-2">{clearSearchIcon}</div>
39-
</div>) : null }
42+
</div>
4043
</div>
4144
);
4245
}

0 commit comments

Comments
 (0)