lbry-desktop/ui/component/searchOptions/index.js

23 lines
894 B
JavaScript
Raw Permalink Normal View History

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';
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),
expanded: selectSearchOptionsExpanded(state),
2021-01-08 23:02:40 +01:00
query: makeSelectQueryWithOptions(undefined, {})(state),
2019-02-18 18:24:56 +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);