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