/** * Just a simple utility class for displaying a popup menu. */ import React, { Component } from 'react'; import { type ResolvableContextAction, type ContextAction } from './ContextActionUtils'; import './ContextActions.scss'; interface ContextActionsProps { actions?: ResolvableContextAction | ResolvableContextAction[]; ignoreClassNames?: string[]; 'data-testid'?: string; } interface ContextActionsState { globalActions: ContextAction[]; keyboardActions: ContextAction[]; } /** * ContextActions that you add onto any component. * * Usage: * let actions = [{ * title: 'My Action', // Omit the title to hide it from the context menu * action: () => { alert('My Action Clicked!') } * actions: [] // Submenu of actions * icon: faPrint, // Limited to FontAwesome icons for now. * iconColor: '#ff0000, // Color to use for the icon * shortcut: Shortcut, // Defaults to null * isGlobal: false, // Global context action. Defaults to false. * group: ContextActions.groups.default, // What group to group the context action with * order: null, // Int where to order within group * disabled: true // disable action * menuElement: null // Custom menu element for displaying in context menu. When null, creates a default menu item based on title * }]; * *