aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/container/HelpBox.js
blob: da4ddac80ce3dbc7c188eff2618ba1531d2ca9ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';

class HelpBox extends React.Component {
  static propTypes = {
    // redux
    results: PropTypes.arrayOf(PropTypes.string).isRequired,
    searchText: PropTypes.string.isRequired,
  }

  render() {
    if (this.props.results.length > 0 || this.props.searchText !== '') {
      return <div />;
    }

    return (
      <div className="help-box">
        <div className="arrow" />
        <div className="bubble">
          Voer hier een docentafkorting, klas, leerlingnummer of lokaalnummer in.
        </div>
      </div>
    );
  }
}

const mapStateToProps = state => ({
  results: state.search.results,
  searchText: state.search.searchText,
});

export default connect(mapStateToProps)(HelpBox);