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

22 lines
809 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';
2021-07-13 07:17:48 +02:00
import { selectSearchOptions } 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';
2021-07-13 07:17:48 +02:00
const select = (state) => ({
2019-02-18 18:24:56 +01:00
options: selectSearchOptions(state),
expanded: selectSearchOptionsExpanded(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);