2019-02-18 18:24:56 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-07-27 22:04:12 +02:00
|
|
|
import { doUpdateSearchOptions } from 'redux/actions/search';
|
|
|
|
import { selectSearchOptions, makeSelectQueryWithOptions } from 'redux/selectors/search';
|
2019-02-21 23:45:17 +01:00
|
|
|
import { doToggleSearchExpanded } from 'redux/actions/app';
|
|
|
|
import { selectSearchOptionsExpanded } from 'redux/selectors/app';
|
2019-02-18 18:24:56 +01:00
|
|
|
import SearchOptions from './view';
|
|
|
|
|
|
|
|
const select = state => ({
|
|
|
|
options: selectSearchOptions(state),
|
2019-02-21 23:45:17 +01:00
|
|
|
expanded: selectSearchOptionsExpanded(state),
|
|
|
|
query: makeSelectQueryWithOptions()(state),
|
2019-02-18 18:24:56 +01:00
|
|
|
});
|
|
|
|
|
2020-01-30 08:09:12 +01:00
|
|
|
const perform = (dispatch, ownProps) => {
|
|
|
|
const additionalOptions = ownProps.additionalOptions || {};
|
|
|
|
return {
|
|
|
|
setSearchOption: (option, value) => dispatch(doUpdateSearchOptions({ [option]: value }, additionalOptions)),
|
|
|
|
toggleSearchExpanded: () => dispatch(doToggleSearchExpanded()),
|
|
|
|
};
|
|
|
|
};
|
2019-02-18 18:24:56 +01:00
|
|
|
|
2020-07-27 22:04:12 +02:00
|
|
|
export default connect(select, perform)(SearchOptions);
|