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

WIP on components AnnotationManifestAccordion

parent a9b5ef2c
Branches
No related tags found
2 merge requests!13Manifest side to side,!11Draft: 33 8 open an other manifest side by side from an annotation
......@@ -9,18 +9,17 @@ import PropTypes from 'prop-types';
import { MiradorMenuButton } from './MiradorMenuButton';
/**
* AnnotationManifestsAccordion ~
* AnnotationManifestsAccordion
*/
export class AnnotationManifestsAccordion extends Component {
/**
* constructor -
* constructor
*/
constructor(props) {
super(props);
this.handleOpenManifestSideToSide = this.handleOpenManifestSideToSide.bind(this);
}
/** */
handleOpenManifestSideToSide(e, manifestId) {
const { addResource, addWindow } = this.props;
......@@ -31,7 +30,7 @@ export class AnnotationManifestsAccordion extends Component {
/** */
render() {
const {
classes, annotation, t
classes, annotation, t,
} = this.props;
/** */
......@@ -45,7 +44,7 @@ export class AnnotationManifestsAccordion extends Component {
annotation.idIsManifest = !!searchManifest(annotation.id);
annotation.manifestsInContent = searchManifest(annotation.content);
if (annotation.manifestsInContent === null) {
if (annotation.manifestsInContent === null && annotation.idIsManifest) {
return null;
}
......@@ -104,12 +103,13 @@ export class AnnotationManifestsAccordion extends Component {
AnnotationManifestsAccordion.propsTypes = {
addResource: PropTypes.func.isRequired,
addWindow: PropTypes.func.isRequired,
annotation:
PropTypes.shape({
annotation: PropTypes.objectOf(
{
id: PropTypes.string.isRequired,
idIsManifest: PropTypes.bool,
manifestsInContent: PropTypes.arrayOf(PropTypes.string),
}),
},
),
classes: PropTypes.objectOf(PropTypes.string),
t: PropTypes.func.isRequired,
};
......
......@@ -8,7 +8,7 @@ import ListItemText from '@material-ui/core/ListItemText';
import Typography from '@material-ui/core/Typography';
import { ScrollTo } from './ScrollTo';
import SanitizedHtml from '../containers/SanitizedHtml';
import { AnnotationManifestsAccordion } from './AnnotationManifestsAccordion';
import AnnotationManifestsAccordion from '../containers/AnnotationManifestsAccordion';
/**
* CanvasAnnotations ~
......@@ -43,7 +43,6 @@ export class CanvasAnnotations extends Component {
/** */
handleAnnotationHover(annotation) {
const { hoverAnnotation, windowId } = this.props;
hoverAnnotation(windowId, [annotation.id]);
}
......
......@@ -5,9 +5,11 @@ import { withStyles } from '@material-ui/core/styles';
import { withPlugins } from '../extend/withPlugins';
import { AnnotationManifestsAccordion } from '../components/AnnotationManifestsAccordion';
import * as actions from '../state/actions';
import { getConfig } from '../state/selectors';
/** For connect */
const mapStateToProps = (state, { canvasId, windowId }) => ({
htmlSanitizationRuleSet: getConfig(state).annotations.htmlSanitizationRuleSet,
});
/**
......@@ -20,7 +22,7 @@ const mapDispatchToProps = {
addWindow: actions.addWindow,
};
/** For withStlyes */
/** For withStyles */
const styles = theme => ({
manifestOpeningIcon: {
width: '30%',
......
......@@ -51,7 +51,7 @@ const mapDispatchToProps = {
selectAnnotation: actions.selectAnnotation,
};
/** For withStlyes */
/** For withStyles */
const styles = theme => ({
annotationListItem: {
'&$hovered': {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment