PanelHeaderMenuItem.tsx 790 B

12345678910111213141516171819202122232425
  1. import React, { FC } from 'react';
  2. import { PanelMenuItem } from '@grafana/ui';
  3. interface Props {
  4. children: any;
  5. }
  6. export const PanelHeaderMenuItem: FC<Props & PanelMenuItem> = props => {
  7. const isSubMenu = props.type === 'submenu';
  8. const isDivider = props.type === 'divider';
  9. return isDivider ? (
  10. <li className="divider" />
  11. ) : (
  12. <li className={isSubMenu ? 'dropdown-submenu' : null}>
  13. <a onClick={props.onClick}>
  14. {props.iconClassName && <i className={props.iconClassName} />}
  15. <span className="dropdown-item-text" aria-label={`${props.text} panel menu item`}>
  16. {props.text}
  17. </span>
  18. {props.shortcut && <span className="dropdown-menu-item-shortcut">{props.shortcut}</span>}
  19. </a>
  20. {props.children}
  21. </li>
  22. );
  23. };