Skip to content
Snippets Groups Projects
Select Git revision
  • 1519fcfce6a0f4555920976b093c35226a96ee34
  • demo_ci_gitlab_pages default
  • demo_gitlab_ci
  • 5-images-in-annotations
  • 5-final-images
  • 5-chpk-images-in-annot
  • tetras-main protected
  • 5-rebase-images-in-annot
  • 5-wip-images-in-annot
  • tmp
  • 1-edit-annotations-on-videos
  • 5-old-images-in-annotations
  • old_demo_ci_gitlab_pages
  • images_annotations
  • wip
  • devsetup
  • wip-annot-video-ui
  • wip-annotations-on-videos
  • master
  • v0.4.0_react16
  • wip-debugging-annotations
21 results

windowSideBarButtonsPlugin.js

Blame
  • Forked from IIIF / Mirador / Mirador annotations
    Source project has a limited visibility.
    windowSideBarButtonsPlugin.js 1.05 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    
    /**
     * A wrapper plugin that sets hasAnyAnnotations to true so that the annotation
     * companion window button is present
     */
    class WindowSideBarButtonWrapper extends Component {
      /** */
      render() {
        const { PluginComponents, TargetComponent, targetProps } = this.props;
        targetProps.hasAnyAnnotations = true;
        return (
          <TargetComponent
            {...targetProps} // eslint-disable-line react/jsx-props-no-spreading
            PluginComponents={PluginComponents}
          />
        );
      }
    }
    
    WindowSideBarButtonWrapper.propTypes = {
      PluginComponents: PropTypes.array, // eslint-disable-line react/forbid-prop-types
      TargetComponent: PropTypes.oneOfType([
        PropTypes.func,
        PropTypes.node,
      ]).isRequired,
      targetProps: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
    };
    
    WindowSideBarButtonWrapper.defaultProps = {
      PluginComponents: [],
    };
    
    export default {
      component: WindowSideBarButtonWrapper,
      mode: 'wrap',
      target: 'WindowSideBarButtons',
    };