You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
706 B

  1. import { connect } from 'react-redux';
  2. import {
  3. changeSearch,
  4. clearSearchSuggestions,
  5. fetchSearchSuggestions,
  6. resetSearch
  7. } from '../../../actions/search';
  8. import Search from '../components/search';
  9. const mapStateToProps = state => ({
  10. suggestions: state.getIn(['search', 'suggestions']),
  11. value: state.getIn(['search', 'value'])
  12. });
  13. const mapDispatchToProps = dispatch => ({
  14. onChange (value) {
  15. dispatch(changeSearch(value));
  16. },
  17. onClear () {
  18. dispatch(clearSearchSuggestions());
  19. },
  20. onFetch (value) {
  21. dispatch(fetchSearchSuggestions(value));
  22. },
  23. onReset () {
  24. dispatch(resetSearch());
  25. }
  26. });
  27. export default connect(mapStateToProps, mapDispatchToProps)(Search);