Skip to content

Commit c4fb567

Browse files
committed
Only display clear icon if search term entered
1 parent 1566561 commit c4fb567

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/js/components/search-input.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ var SearchInput = React.createClass({
2121
},
2222

2323
render: function () {
24+
var clearSearchIcon;
25+
26+
if (this.state.searchTerm) {
27+
clearSearchIcon = (
28+
<span className='octicon octicon-x' onClick={this.clearSearch} />
29+
);
30+
}
31+
2432
return (
2533
<div className='search-wrapper'>
26-
<span className='octicon octicon-x' onClick={this.clearSearch} />
34+
{clearSearchIcon}
2735
<input
2836
value={this.state.searchTerm}
2937
onChange={this.onChange}

0 commit comments

Comments
 (0)