about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/compose/containers/search_container.jsx
blob: 17a68f2fc8a4f6be99defaf23d35adc23e0d2226 (plain) (blame)
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
34
35
import { connect } from 'react-redux';
import {
  changeSearch,
  clearSearchSuggestions,
  fetchSearchSuggestions,
  resetSearch
} from '../../../actions/search';
import Search from '../components/search';

const mapStateToProps = state => ({
  suggestions: state.getIn(['search', 'suggestions']),
  value: state.getIn(['search', 'value'])
});

const mapDispatchToProps = dispatch => ({

  onChange (value) {
    dispatch(changeSearch(value));
  },

  onClear () {
    dispatch(clearSearchSuggestions());
  },

  onFetch (value) {
    dispatch(fetchSearchSuggestions(value));
  },

  onReset () {
    dispatch(resetSearch());
  }

});

export default connect(mapStateToProps, mapDispatchToProps)(Search);