2019-11-10 20:39:22 +00:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
2020-08-26 15:28:53 +00:00
|
|
|
import i18next from 'i18next';
|
2019-11-10 20:39:22 +00:00
|
|
|
import * as SortingActions from '../../actions/sorting';
|
|
|
|
|
|
|
|
import Searchbar from './Searchbar';
|
|
|
|
|
2020-08-26 15:28:53 +00:00
|
|
|
|
2019-11-10 20:39:22 +00:00
|
|
|
const scope = 'collection';
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
2020-08-26 15:28:53 +00:00
|
|
|
searchLabel: i18next.t('Searchbar.SearchCollection'),
|
2019-11-10 20:39:22 +00:00
|
|
|
searchTerm: state.search[`${scope}SearchTerm`],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
const actions = {
|
|
|
|
setSearchTerm: term => SortingActions.setSearchTerm(scope, term),
|
|
|
|
resetSearchTerm: () => SortingActions.resetSearchTerm(scope),
|
|
|
|
};
|
|
|
|
return bindActionCreators(Object.assign({}, actions), dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Searchbar);
|