diff --git a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx index b6c3dfae3e3..8fb63f23eac 100644 --- a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx +++ b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx @@ -11,10 +11,11 @@ export interface Props extends React.HTMLAttributes { color?: string; gradient?: string; lineStyle?: LineStyle; + noMargin?: boolean; } export const SeriesIcon = React.memo( - React.forwardRef(({ color, className, gradient, lineStyle, ...restProps }, ref) => { + React.forwardRef(({ color, className, gradient, lineStyle, noMargin, ...restProps }, ref) => { const theme = useTheme2(); const styles = useStyles2(getStyles); @@ -59,7 +60,7 @@ export const SeriesIcon = React.memo(
@@ -68,8 +69,10 @@ export const SeriesIcon = React.memo( ); const getStyles = (theme: GrafanaTheme2) => ({ - container: css({ + margin: css({ marginRight: '8px', + }), + container: css({ display: 'inline-block', width: '14px', height: '4px', diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipColorIndicator.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipColorIndicator.tsx index 789b50cba2a..2aac9839a2e 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipColorIndicator.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipColorIndicator.tsx @@ -33,31 +33,23 @@ export const VizTooltipColorIndicator = ({ }: Props) => { const styles = useStyles2(getStyles); - if (isHollow) { + if (colorIndicator === ColorIndicator.series && !isHollow) { return ( -
); } - if (colorIndicator === ColorIndicator.series) { - return ( - - ); - } - return ( - ({ trailing: css({ marginLeft: theme.spacing(0.5), }), + seriesIndicator: css({ + position: 'relative', + top: -2, // half the height of the color indicator, since the top is aligned with flex center. + }), series: css({ width: '14px', height: '4px', diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx index 157264c4df6..22426f6fbf0 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx @@ -225,7 +225,7 @@ const getStyles = (theme: GrafanaTheme2, justify = 'start', marginRight?: string maxWidth: '100%', alignItems: 'start', justifyContent: justify, - columnGap: '6px', + columnGap: theme.spacing(0.75), }), label: css({ display: 'inline' }), value: css({ @@ -235,10 +235,7 @@ const getStyles = (theme: GrafanaTheme2, justify = 'start', marginRight?: string }), colorWrapper: css({ alignSelf: 'center', - position: 'relative', flexShrink: 0, - top: -2, // half the height of the color indicator, since the top is aligned with flex center. - marginRight: '-6px', // account for the built-in column-gap in relation to the color indicator's margin }), labelWrapper: css({ flexGrow: 1, @@ -248,6 +245,8 @@ const getStyles = (theme: GrafanaTheme2, justify = 'start', marginRight?: string fontWeight: 400, }), valueWrapper: css({ + display: 'flex', + alignItems: 'center', flexShrink: 0, alignSelf: 'center', marginRight,