Skip to content
Snippets Groups Projects
Commit 4db3a84c authored by Jack Reed's avatar Jack Reed
Browse files

Enable plugins for CanvasAnnotations, and enable MaterialUI props to be passed in

parent 31ed6471
Branches
Tags
No related merge requests found
...@@ -58,6 +58,7 @@ export class CanvasAnnotations extends Component { ...@@ -58,6 +58,7 @@ export class CanvasAnnotations extends Component {
render() { render() {
const { const {
annotations, classes, index, label, selectedAnnotationIds, t, totalSize, annotations, classes, index, label, selectedAnnotationIds, t, totalSize,
listContainerComponent,
} = this.props; } = this.props;
if (annotations.length === 0) return <></>; if (annotations.length === 0) return <></>;
...@@ -71,9 +72,10 @@ export class CanvasAnnotations extends Component { ...@@ -71,9 +72,10 @@ export class CanvasAnnotations extends Component {
annotations.map(annotation => ( annotations.map(annotation => (
<ListItem <ListItem
button button
component="li" component={listContainerComponent}
className={classes.annotationListItem} className={classes.annotationListItem}
key={annotation.id} key={annotation.id}
annotationid={annotation.id}
selected={selectedAnnotationIds.includes(annotation.id)} selected={selectedAnnotationIds.includes(annotation.id)}
onClick={e => this.handleClick(e, annotation)} onClick={e => this.handleClick(e, annotation)}
onFocus={() => this.handleAnnotationHighlight(annotation)} onFocus={() => this.handleAnnotationHighlight(annotation)}
...@@ -106,6 +108,7 @@ CanvasAnnotations.propTypes = { ...@@ -106,6 +108,7 @@ CanvasAnnotations.propTypes = {
highlightAnnotation: PropTypes.func.isRequired, highlightAnnotation: PropTypes.func.isRequired,
index: PropTypes.number.isRequired, index: PropTypes.number.isRequired,
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
listContainerComponent: PropTypes.elementType,
selectAnnotation: PropTypes.func.isRequired, selectAnnotation: PropTypes.func.isRequired,
selectedAnnotationIds: PropTypes.arrayOf(PropTypes.string), selectedAnnotationIds: PropTypes.arrayOf(PropTypes.string),
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
...@@ -115,5 +118,6 @@ CanvasAnnotations.propTypes = { ...@@ -115,5 +118,6 @@ CanvasAnnotations.propTypes = {
CanvasAnnotations.defaultProps = { CanvasAnnotations.defaultProps = {
annotations: [], annotations: [],
classes: {}, classes: {},
listContainerComponent: 'li',
selectedAnnotationIds: [], selectedAnnotationIds: [],
}; };
...@@ -2,6 +2,7 @@ import { compose } from 'redux'; ...@@ -2,6 +2,7 @@ import { compose } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import { withPlugins } from '../extend/withPlugins';
import * as actions from '../state/actions'; import * as actions from '../state/actions';
import { import {
getAnnotationResourcesByMotivationForCanvas, getAnnotationResourcesByMotivationForCanvas,
...@@ -69,6 +70,7 @@ const enhance = compose( ...@@ -69,6 +70,7 @@ const enhance = compose(
withTranslation(), withTranslation(),
withStyles(styles), withStyles(styles),
connect(mapStateToProps, mapDispatchToProps), connect(mapStateToProps, mapDispatchToProps),
withPlugins('CanvasAnnotations'),
); );
export default enhance(CanvasAnnotations); export default enhance(CanvasAnnotations);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment