diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-11-30 16:27:23 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-12-01 16:27:22 -0500 |
commit | 713115be51cbc20e90be2153772e6f184ce7c76d (patch) | |
tree | 08e4a1138c0d7a3e7962b216b91762999b4f3618 /web/react/components | |
parent | 6d10b103189168c556456319115774b41ee5ac73 (diff) | |
download | chat-713115be51cbc20e90be2153772e6f184ce7c76d.tar.gz chat-713115be51cbc20e90be2153772e6f184ce7c76d.tar.bz2 chat-713115be51cbc20e90be2153772e6f184ce7c76d.zip |
Fixed SuggestionLists to properly hide when the textbox loses focus
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/search_suggestion_list.jsx | 4 | ||||
-rw-r--r-- | web/react/components/suggestion_box.jsx | 9 | ||||
-rw-r--r-- | web/react/components/suggestion_list.jsx | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/web/react/components/search_suggestion_list.jsx b/web/react/components/search_suggestion_list.jsx index 739b7199d..1549e90d5 100644 --- a/web/react/components/search_suggestion_list.jsx +++ b/web/react/components/search_suggestion_list.jsx @@ -35,7 +35,7 @@ export default class SearchSuggestionList extends SuggestionList { } render() { - if (this.state.items.length === 0) { + if (this.state.items.length === 0 || !this.props.show) { return null; } @@ -82,5 +82,5 @@ export default class SearchSuggestionList extends SuggestionList { } SearchSuggestionList.propTypes = { - suggestionId: React.PropTypes.string.isRequired + ...SuggestionList.propTypes }; diff --git a/web/react/components/suggestion_box.jsx b/web/react/components/suggestion_box.jsx index 5510ba340..3fff5b754 100644 --- a/web/react/components/suggestion_box.jsx +++ b/web/react/components/suggestion_box.jsx @@ -147,8 +147,6 @@ export default class SuggestionBox extends React.Component { } render() { - const SuggestionList = this.props.listComponent; - const newProps = Object.assign({}, this.props, { onFocus: this.handleFocus, onChange: this.handleChange, @@ -173,10 +171,15 @@ export default class SuggestionBox extends React.Component { ); } + const SuggestionListComponent = this.props.listComponent; + return ( <div> {textbox} - <SuggestionList suggestionId={this.suggestionId} /> + <SuggestionListComponent + suggestionId={this.suggestionId} + show={this.state.focused} + /> </div> ); } diff --git a/web/react/components/suggestion_list.jsx b/web/react/components/suggestion_list.jsx index ec3888ebb..3b7c4dd7d 100644 --- a/web/react/components/suggestion_list.jsx +++ b/web/react/components/suggestion_list.jsx @@ -87,7 +87,7 @@ export default class SuggestionList extends React.Component { } render() { - if (this.state.items.length === 0) { + if (this.state.items.length === 0 || !this.props.show) { return null; } @@ -125,5 +125,6 @@ export default class SuggestionList extends React.Component { } SuggestionList.propTypes = { - suggestionId: React.PropTypes.string.isRequired + suggestionId: React.PropTypes.string.isRequired, + show: React.PropTypes.bool.isRequired }; |