Skip to content
Snippets Groups Projects
Select Git revision
  • c4727b6afbf6ac8bd65d4c2e91198aadfd578c04
  • master default protected
  • 12-dot-genere-non-coherent
  • unl-tools-release-0.9
  • v0.9
5 results

unl-parser.iml

Blame
  • 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',
    };