diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipContent.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipContent.tsx index 661581237a7..2fad357a791 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipContent.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipContent.tsx @@ -43,7 +43,6 @@ export const VizTooltipContent = ({ colorIndicator={colorIndicator} colorPlacement={colorPlacement} isActive={isActive} - justify={'space-between'} isPinned={isPinned} lineStyle={lineStyle} showValueScroll={!scrollable} diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx index 1471dc5e38a..157264c4df6 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx @@ -1,4 +1,5 @@ -import { css, cx } from '@emotion/css'; +import { css } from '@emotion/css'; +import clsx from 'clsx'; import { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react'; import * as React from 'react'; @@ -29,6 +30,7 @@ enum LabelValueTypes { const SUCCESSFULLY_COPIED_TEXT = 'Copied to clipboard'; const SHOW_SUCCESS_DURATION = 2 * 1000; const HORIZONTAL_PX_PER_CHAR = 7; +const CAN_COPY = Boolean(navigator.clipboard && window.isSecureContext); export const VizTooltipRow = ({ label, @@ -36,9 +38,9 @@ export const VizTooltipRow = ({ color, colorIndicator, colorPlacement = ColorPlacement.first, - justify = 'flex-start', + justify, isActive = false, - marginRight = '0px', + marginRight, isPinned, lineStyle, showValueScroll, @@ -82,7 +84,7 @@ export const VizTooltipRow = ({ }, [showCopySuccess]); const copyToClipboard = async (text: string, type: LabelValueTypes) => { - if (!(navigator?.clipboard && window.isSecureContext)) { + if (!CAN_COPY) { fallbackCopyToClipboard(text, type); return; } @@ -131,18 +133,20 @@ export const VizTooltipRow = ({ return (