aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-06-26 22:28:33 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-06-26 22:28:33 +0200
commit7284f4bb640e9213b13e978df1fae768bb620e93 (patch)
treee608024373961b7033fd2eff8c74ef46e533e51f /src/client/react/components
parentdedf8025a547d698d9f2e62f0897493d61ffadd5 (diff)
Calculate isVisible in redux
Diffstat (limited to 'src/client/react/components')
-rw-r--r--src/client/react/components/container/HelpBox.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/react/components/container/HelpBox.js b/src/client/react/components/container/HelpBox.js
index 6579383..3358a76 100644
--- a/src/client/react/components/container/HelpBox.js
+++ b/src/client/react/components/container/HelpBox.js
@@ -27,13 +27,13 @@ import './HelpBox.scss';
class HelpBox extends React.Component {
static propTypes = {
// redux
- results: PropTypes.arrayOf(PropTypes.string).isRequired,
- searchText: PropTypes.string.isRequired,
+ isVisible: PropTypes.bool.isRequired,
}
render() {
- const { results, searchText } = this.props;
- if (results.length > 0 || searchText !== '') {
+ const { isVisible } = this.props;
+
+ if (!isVisible) {
return <div />;
}
@@ -49,8 +49,7 @@ class HelpBox extends React.Component {
}
const mapStateToProps = state => ({
- results: state.search.results,
- searchText: state.search.text,
+ isVisible: state.search.results.length === 0 && state.search.text === '',
});
export default connect(mapStateToProps)(HelpBox);