grafana/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuItem.tsx
2018-11-07 13:55:02 +01:00

24 lines
731 B
TypeScript

import React, { SFC } from 'react';
import { PanelMenuItem } from 'app/types/panel';
interface Props {
children: any;
}
export const PanelHeaderMenuItem: SFC<Props & PanelMenuItem> = props => {
const isSubMenu = props.type === 'submenu';
const isDivider = props.type === 'divider';
return isDivider ? (
<li className="divider" />
) : (
<li className={isSubMenu ? 'dropdown-submenu' : null}>
<a onClick={props.onClick}>
{props.iconClassName && <i className={props.iconClassName} />}
<span className="dropdown-item-text">{props.text}</span>
{props.shortcut && <span className="dropdown-menu-item-shortcut">{props.shortcut}</span>}
</a>
{props.children}
</li>
);
};