2019-11-10 21:39:22 +01:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
2020-08-26 17:28:53 +02:00
|
|
|
import i18next from 'i18next';
|
2019-11-10 21:39:22 +01:00
|
|
|
import * as SortingActions from '../../actions/sorting';
|
|
|
|
|
|
|
|
import Searchbar from './Searchbar';
|
|
|
|
|
2020-08-26 17:28:53 +02:00
|
|
|
|
2019-11-10 21:39:22 +01:00
|
|
|
const scope = 'collection';
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
2020-08-26 17:28:53 +02:00
|
|
|
searchLabel: i18next.t('Searchbar.SearchCollection'),
|
2019-11-10 21:39:22 +01: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);
|