Select Git revision
setupJest.js
SearchResults.js 1.34 KiB
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles';
import { withPlugins } from '../extend/withPlugins';
import { SearchResults } from '../components/SearchResults';
import * as actions from '../state/actions';
import {
getSearchHitsForCompanionWindow,
getSelectedContentSearchAnnotationIds,
getSearchForCompanionWindow,
} from '../state/selectors';
/**
* mapStateToProps - used to hook up connect to state
* @memberof SearchResult
* @private
*/
const mapStateToProps = (state, { companionWindowId, windowId }) => ({
searchHits: getSearchHitsForCompanionWindow(state, { companionWindowId, windowId }),
selectedContentSearchAnnotation: getSelectedContentSearchAnnotationIds(state, { windowId }),
startIndex: getSearchForCompanionWindow(state, { companionWindowId, windowId }).startIndex,
});
const mapDispatchToProps = {
selectContentSearchAnnotation: actions.selectContentSearchAnnotation,
};
/** */
const styles = theme => ({
navigation: {
textTransform: 'none',
},
toggleFocus: {
...theme.typography.subtitle1,
},
});
const enhance = compose(
connect(mapStateToProps, mapDispatchToProps),
withStyles(styles),
withTranslation(),
withPlugins('SearchResults'),
);
export default enhance(SearchResults);