mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
40 lines (35 loc) • 1.33 kB
JavaScript
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withPlugins } from '../extend/withPlugins';
import { SearchPanelNavigation } from '../components/SearchPanelNavigation';
import * as actions from '../state/actions';
import {
getSelectedContentSearchAnnotationIds,
getSearchNumTotal,
getSortedSearchHitsForCompanionWindow,
getThemeDirection,
} from '../state/selectors';
/**
* mapStateToProps - used to hook up connect to state
* @memberof SearchPanelControls
* @private
*/
const mapStateToProps = (state, { companionWindowId, windowId }) => ({
direction: getThemeDirection(state),
numTotal: getSearchNumTotal(state, { companionWindowId, windowId }),
searchHits: getSortedSearchHitsForCompanionWindow(state, { companionWindowId, windowId }),
selectedContentSearchAnnotation: getSelectedContentSearchAnnotationIds(state, {
companionWindowId,
windowId,
}),
});
/**
* mapDispatchToProps - to hook up connect
* @memberof SearchPanelNavigation
* @private
*/
const mapDispatchToProps = (dispatch, { windowId }) => ({
selectAnnotation: (...args) => dispatch(actions.selectAnnotation(windowId, ...args)),
});
const enhance = compose(connect(mapStateToProps, mapDispatchToProps), withPlugins('SearchPanelNavigation'));
export default enhance(SearchPanelNavigation);