GraphNG: Context menu (#29745)

* Refactor Context menu and add Menu component to grafana/ui

* ContextMenuPlugin WIP

* Fix docs issues

* Remove Add annotations menu item from graph context menu

* ts ifx
This commit is contained in:
Dominik Prokop
2020-12-15 10:53:04 +01:00
committed by GitHub
parent 92527c2647
commit 69b05aae46
14 changed files with 511 additions and 314 deletions

View File

@@ -1,11 +1,12 @@
import React, { useState } from 'react';
import { ContextMenu, ContextMenuGroup } from '../ContextMenu/ContextMenu';
import { ContextMenu } from '../ContextMenu/ContextMenu';
import { MenuItemsGroup } from '../Menu/Menu';
interface WithContextMenuProps {
/** Menu item trigger that accepts openMenu prop */
children: (props: { openMenu: React.MouseEventHandler<HTMLElement> }) => JSX.Element;
/** A function that returns an array of menu items */
getContextMenuItems: () => ContextMenuGroup[];
getContextMenuItems: () => MenuItemsGroup[];
}
export const WithContextMenu: React.FC<WithContextMenuProps> = ({ children, getContextMenuItems }) => {