Skip to content
Snippets Groups Projects
Commit 6cea9853 authored by Anthony's avatar Anthony
Browse files

WIP on components AnnotationManifestAccordion

Accordion opening correctly
parent b5a0ca6b
No related branches found
No related tags found
2 merge requests!13Manifest side to side,!11Draft: 33 8 open an other manifest side by side from an annotation
...@@ -18,6 +18,7 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -18,6 +18,7 @@ export class AnnotationManifestsAccordion extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleOpenManifestSideToSide = this.handleOpenManifestSideToSide.bind(this); this.handleOpenManifestSideToSide = this.handleOpenManifestSideToSide.bind(this);
this.handleOpenAccordion = this.handleOpenAccordion.bind(this);
} }
/** */ /** */
...@@ -27,6 +28,11 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -27,6 +28,11 @@ export class AnnotationManifestsAccordion extends Component {
addWindow({ manifestId }); addWindow({ manifestId });
} }
/** */
handleOpenAccordion(e) {
e.stopPropagation();
}
/** */ /** */
render() { render() {
const { const {
...@@ -40,20 +46,21 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -40,20 +46,21 @@ export class AnnotationManifestsAccordion extends Component {
); );
} }
console.log(annotation);
annotation.idIsManifest = !!searchManifest(annotation.id); annotation.idIsManifest = !!searchManifest(annotation.id);
annotation.manifestsInContent = searchManifest(annotation.content); annotation.manifestsInContent = searchManifest(annotation.content);
if (annotation.manifestsInContent === null && annotation.idIsManifest) { if (annotation.manifestsInContent === null && !annotation.idIsManifest) {
return null; return null;
} }
return ( return (
(annotation.idIsManifest || annotation.manifestsInContent) && ( (annotation.idIsManifest || annotation.manifestsInContent) && (
<div> <div>
{annotation.idIsManifest}
<Accordion> <Accordion>
<AccordionSummary <AccordionSummary
expandIcon={<ExpandMoreIcon />} expandIcon={<ExpandMoreIcon />}
onClick={(e) => this.handleOpenAccordion(e)}
> >
<Typography className={classes.heading}>Manifests found :</Typography> <Typography className={classes.heading}>Manifests found :</Typography>
</AccordionSummary> </AccordionSummary>
...@@ -103,7 +110,7 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -103,7 +110,7 @@ export class AnnotationManifestsAccordion extends Component {
AnnotationManifestsAccordion.propsTypes = { AnnotationManifestsAccordion.propsTypes = {
addResource: PropTypes.func.isRequired, addResource: PropTypes.func.isRequired,
addWindow: PropTypes.func.isRequired, addWindow: PropTypes.func.isRequired,
annotation: PropTypes.objectOf( annotation: PropTypes.shape(
{ {
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
idIsManifest: PropTypes.bool, idIsManifest: PropTypes.bool,
...@@ -115,7 +122,6 @@ AnnotationManifestsAccordion.propsTypes = { ...@@ -115,7 +122,6 @@ AnnotationManifestsAccordion.propsTypes = {
}; };
AnnotationManifestsAccordion.defaultProps = { AnnotationManifestsAccordion.defaultProps = {
annotation: {},
classes: {}, classes: {},
htmlSanitizationRuleSet: 'iiif', htmlSanitizationRuleSet: 'iiif',
listContainerComponent: 'li', listContainerComponent: 'li',
......
...@@ -57,12 +57,11 @@ export class CanvasAnnotations extends Component { ...@@ -57,12 +57,11 @@ export class CanvasAnnotations extends Component {
*/ */
render() { render() {
const { const {
annotations, autoScroll, classes, index, label, selectedAnnotationId, t, totalSize,
listContainerComponent, htmlSanitizationRuleSet, hoveredAnnotationIds, listContainerComponent, htmlSanitizationRuleSet, hoveredAnnotationIds,
annotations, autoScroll, classes, index, label, selectedAnnotationId, t, totalSize,
containerRef, containerRef,
} = this.props; } = this.props;
if (annotations.length === 0) return null; if (annotations.length === 0) return null;
console.log(annotations);
return ( return (
<> <>
<Typography className={classes.sectionHeading} variant="overline"> <Typography className={classes.sectionHeading} variant="overline">
...@@ -106,13 +105,15 @@ export class CanvasAnnotations extends Component { ...@@ -106,13 +105,15 @@ export class CanvasAnnotations extends Component {
<Chip size="small" variant="outlined" label={tag} id={tag} className={classes.chip} key={tag.toString()} /> <Chip size="small" variant="outlined" label={tag} id={tag} className={classes.chip} key={tag.toString()} />
)) ))
} }
</div>
</ListItemText>
</MenuItem>
<AnnotationManifestsAccordion <AnnotationManifestsAccordion
annotation={annotation} annotation={annotation}
t={t} t={t}
/> />
</div>
</ListItemText>
</MenuItem>
</ScrollTo> </ScrollTo>
)) ))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment