Skip to content
Snippets Groups Projects
Select Git revision
  • 0a82c70a8b997de5bb3cdfda570c98a576cb149d
  • 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

miradorAnnotationPlugin.js

Blame
  • Forked from IIIF / Mirador / Mirador annotations
    Source project has a limited visibility.
    WindowTopMenuButton.js 1.84 KiB
    import React, { Component } from 'react';
    import { compose } from 'redux';
    import IconButton from '@material-ui/core/IconButton';
    import MoreVertIcon from '@material-ui/icons/MoreVert';
    import { withStyles } from '@material-ui/core/styles';
    import PropTypes from 'prop-types';
    import WindowTopMenu from '../containers/WindowTopMenu';
    
    /**
     */
    class WindowTopMenuButton extends Component {
      /**
       * constructor -
       */
      constructor(props) {
        super(props);
        this.state = {
          anchorEl: null,
        };
        this.handleMenuClick = this.handleMenuClick.bind(this);
        this.handleMenuClose = this.handleMenuClose.bind(this);
      }
    
      /**
       * @private
       */
      handleMenuClick(event) {
        this.setState({
          anchorEl: event.currentTarget,
        });
      }
    
      /**
       * @private
       */
      handleMenuClose() {
        this.setState({
          anchorEl: null,
        });
      }
    
      /**
       * render
       * @return
       */
      render() {
        const { classes, windowId } = this.props;
        const { anchorEl } = this.state;
    
        return (
          <>
            <IconButton
              color="primary"
              aria-label="Menu"
              className={classes.ctrlBtn}
              aria-haspopup="true"
              onClick={this.handleMenuClick}
              aria-owns={anchorEl ? `window-menu_${windowId}` : undefined}
            >
              <MoreVertIcon />
            </IconButton>
            <WindowTopMenu
              windowId={windowId}
              anchorEl={anchorEl}
              handleClose={this.handleMenuClose}
            />
          </>
        );
      }
    }
    
    WindowTopMenuButton.propTypes = {
      windowId: PropTypes.string.isRequired,
      classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
    };
    
    /**
     * @private
     */
    const styles = theme => ({
      ctrlBtn: {
        margin: theme.spacing.unit,
      },
    });
    
    
    const enhance = compose(
      withStyles(styles),
      // further HOC go here
    );
    
    export default enhance(WindowTopMenuButton);