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

WIP opening manifest Card

parent 6cea9853
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
...@@ -6,7 +6,8 @@ import Typography from '@material-ui/core/Typography'; ...@@ -6,7 +6,8 @@ import Typography from '@material-ui/core/Typography';
import AccordionDetails from '@material-ui/core/AccordionDetails'; import AccordionDetails from '@material-ui/core/AccordionDetails';
import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd'; import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { MiradorMenuButton } from './MiradorMenuButton'; import { Card, CardActionArea, CardActions, CardContent, CardMedia, Fab } from '@material-ui/core';
import Button from '@material-ui/core/Button';
/** /**
* AnnotationManifestsAccordion * AnnotationManifestsAccordion
...@@ -29,6 +30,7 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -29,6 +30,7 @@ export class AnnotationManifestsAccordion extends Component {
} }
/** */ /** */
// eslint-disable-next-line class-methods-use-this,require-jsdoc
handleOpenAccordion(e) { handleOpenAccordion(e) {
e.stopPropagation(); e.stopPropagation();
} }
...@@ -46,17 +48,14 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -46,17 +48,14 @@ export class AnnotationManifestsAccordion extends Component {
); );
} }
annotation.idIsManifest = !!searchManifest(annotation.id); annotation.manifests = searchManifest(annotation.content.concat(annotation.id));
annotation.manifestsInContent = searchManifest(annotation.content);
if (annotation.manifestsInContent === null && !annotation.idIsManifest) { if (annotation.manifests === null) {
return null; return null;
} }
return ( return (
(annotation.idIsManifest || annotation.manifestsInContent) && (
<div> <div>
{annotation.idIsManifest}
<Accordion> <Accordion>
<AccordionSummary <AccordionSummary
expandIcon={<ExpandMoreIcon />} expandIcon={<ExpandMoreIcon />}
...@@ -66,43 +65,40 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -66,43 +65,40 @@ export class AnnotationManifestsAccordion extends Component {
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<Typography> <Typography>
{annotation.idIsManifest && ( {annotation.manifests.map(manifestId => (
<div className={classes.manifestOpeningWrapper}> <Card className={classes.root}>
<div>{annotation.id}</div> <CardActionArea>
<MiradorMenuButton <CardMedia
aria-haspopup="true" component="img"
aria-label={t('openManifestInOtherWindow', { manifest: annotation.id })} alt="Contemplative Reptile"
titleAccess={t('openManifestInOtherWindow', { manifest: annotation.id })} height="140"
onClick={(e) => { image="https://www.tetras-libre.fr/themes/tetras/img/logo.svg"
this.handleOpenManifestSideToSide(e, annotation.id); title="Tetras tooltip"
}} />
className={classes.manifestOpeningButton} <CardContent>
> <Typography gutterBottom variant="h5" component="h2">
<PlaylistAddIcon /> Lizard
</MiradorMenuButton> </Typography>
</div> <Typography variant="body2" color="textSecondary" component="p">
)} Lizards are a widespread group of squamate reptiles, with over 6,000 species, ranging
{annotation.manifestsInContent && annotation.manifestsInContent.map(manifestId => ( across all continents except Antarctica
<div className={classes.manifestOpeningWrapper}> </Typography>
<div>{manifestId}</div> </CardContent>
<MiradorMenuButton </CardActionArea>
aria-haspopup="true" <CardActions>
aria-label={t('openManifestInOtherWindow')} <Button size="small" color="primary">
titleAccess={t('openManifestInOtherWindow')} Share
onClick={(e) => { </Button>
this.handleOpenManifestSideToSide(e, manifestId); <Button size="small" color="primary">
}} Learn More
className={classes.manifestOpeningButton} </Button>
> </CardActions>
<PlaylistAddIcon /> </Card>
</MiradorMenuButton>
</div>
))} ))}
</Typography> </Typography>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
</div> </div>
)
); );
} }
} }
...@@ -112,9 +108,9 @@ AnnotationManifestsAccordion.propsTypes = { ...@@ -112,9 +108,9 @@ AnnotationManifestsAccordion.propsTypes = {
addWindow: PropTypes.func.isRequired, addWindow: PropTypes.func.isRequired,
annotation: PropTypes.shape( annotation: PropTypes.shape(
{ {
content: PropTypes.string.isRequired,
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
idIsManifest: PropTypes.bool, manifests: PropTypes.arrayOf(PropTypes.string),
manifestsInContent: PropTypes.arrayOf(PropTypes.string),
}, },
), ),
classes: PropTypes.objectOf(PropTypes.string), classes: PropTypes.objectOf(PropTypes.string),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment