lbry-desktop/ui/component/searchOptions/index.js
jessop c7351551da blocks mature content from search when appropriate
wip bump lbry-redux

refactor search selector

bump redux
2020-01-31 15:10:35 -05:00

24 lines
836 B
JavaScript

import { connect } from 'react-redux';
import { selectSearchOptions, doUpdateSearchOptions, makeSelectQueryWithOptions } from 'lbry-redux';
import { doToggleSearchExpanded } from 'redux/actions/app';
import { selectSearchOptionsExpanded } from 'redux/selectors/app';
import SearchOptions from './view';
const select = state => ({
options: selectSearchOptions(state),
expanded: selectSearchOptionsExpanded(state),
query: makeSelectQueryWithOptions()(state),
});
const perform = (dispatch, ownProps) => {
const additionalOptions = ownProps.additionalOptions || {};
return {
setSearchOption: (option, value) => dispatch(doUpdateSearchOptions({ [option]: value }, additionalOptions)),
toggleSearchExpanded: () => dispatch(doToggleSearchExpanded()),
};
};
export default connect(
select,
perform
)(SearchOptions);