import { Icon, IconName, useStyles, Tooltip } from '@grafana/ui'; import { PopoverContent } from '@grafana/ui/src/components/Tooltip/Tooltip'; import { TooltipPlacement } from '@grafana/ui/src/components/Tooltip/PopoverController'; import React, { FC } from 'react'; import { css, cx } from '@emotion/css'; import { Link } from 'react-router-dom'; interface Props { tooltip: PopoverContent; icon: IconName; className?: string; tooltipPlacement?: TooltipPlacement; to?: string; target?: string; onClick?: (e: React.MouseEvent) => void; 'data-testid'?: string; } export const ActionIcon: FC = ({ tooltip, icon, to, target, onClick, className, tooltipPlacement = 'top', ...rest }) => { const iconEl = ( ); const ariaLabel = typeof tooltip === 'string' ? tooltip : undefined; return ( {(() => { if (to) { return ( {iconEl} ); } return iconEl; })()} ); }; export const getStyle = () => css` cursor: pointer; `;