chinwagsocial/app/javascript/mastodon/features/compose/containers/search_container.js

52 lines
992 B
JavaScript
Raw Normal View History

2016-11-13 23:04:18 +11:00
import { connect } from 'react-redux';
import {
changeSearch,
2017-04-01 04:59:54 +11:00
clearSearch,
submitSearch,
showSearch,
openURL,
clickSearchResult,
forgetSearchResult,
} from 'mastodon/actions/search';
2016-11-13 23:04:18 +11:00
import Search from '../components/search';
const mapStateToProps = state => ({
2017-04-01 07:44:12 +11:00
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted']),
recent: state.getIn(['search', 'recent']),
2016-11-13 23:04:18 +11:00
});
const mapDispatchToProps = dispatch => ({
onChange (value) {
dispatch(changeSearch(value));
},
onClear () {
2017-04-01 04:59:54 +11:00
dispatch(clearSearch());
2016-11-13 23:04:18 +11:00
},
onSubmit (type) {
dispatch(submitSearch(type));
2016-11-13 23:04:18 +11:00
},
2017-04-01 04:59:54 +11:00
onShow () {
dispatch(showSearch());
},
2016-11-13 23:04:18 +11:00
onOpenURL (q, routerHistory) {
dispatch(openURL(q, routerHistory));
},
onClickSearchResult (q, type) {
dispatch(clickSearchResult(q, type));
},
onForgetSearchResult (q) {
dispatch(forgetSearchResult(q));
},
2016-11-13 23:04:18 +11:00
});
export default connect(mapStateToProps, mapDispatchToProps)(Search);