import { Typography } from '@mui/material'; import type { ReactElement } from 'react'; import { EllipsisTypography, formatMetricName, formatMetricValue } from '../../..'; import { Tooltip } from '../../../components'; import type { Line } from '../../common/timeSeries/models'; import LegendContent from './LegendContent'; import { LegendDisplayMode } from './models'; interface MinMaxAvgEntry { label: string; value: number | null; } interface Props { isDisplayedOnSide: boolean; isListMode: boolean; line: Line; minMaxAvg?: Array; unit: string; value?: string | null; } const LegendHeader = ({ line, value, minMaxAvg, isListMode, isDisplayedOnSide, unit }: Props): ReactElement => { const { name, legend } = line; const metricName = formatMetricName({ legend, name }); const legendName = legend || name; return (
{legendName}
{minMaxAvg.map(({ label, value: subValue }) => ( ))}
) : ( legendName ) } placement={isListMode ? 'right' : 'top'} >
{metricName} {unit}
); }; export default LegendHeader;