Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2568 from matrix-org/bwindels/fixcollapsesearchterm
Browse files Browse the repository at this point in the history
Fix: search term disappears when collapsing and expanding left panel
  • Loading branch information
dbkr authored Feb 5, 2019
2 parents 4dd8feb + a6d7f6a commit 8598c4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/structures/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ const LeftPanel = React.createClass({
},
);

const searchBox = !this.props.collapsed ?
<SearchBox onSearch={ this.onSearch } onCleared={ this.onSearchCleared } /> :
undefined;
const searchBox = (<SearchBox
onSearch={ this.onSearch }
onCleared={ this.onSearchCleared }
collapsed={this.props.collapsed} />);

return (
<div className={containerClasses}>
Expand Down
9 changes: 7 additions & 2 deletions src/components/structures/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ module.exports = React.createClass({
},

render: function() {
const TintableSvg = sdk.getComponent('elements.TintableSvg');

// check for collapsed here and
// not at parent so we keep
// searchTerm in our state
// when collapsing and expanding
if (this.props.collapsed) {
return null;
}
const clearButton = this.state.searchTerm.length > 0 ?
(<AccessibleButton key="button"
className="mx_SearchBox_closeButton"
Expand Down

0 comments on commit 8598c4f

Please sign in to comment.