2022-12-29 00:43:22 +01:00
|
|
|
import { StatusLight } from 'react-basics';
|
2020-10-15 07:09:00 +02:00
|
|
|
import styles from './ChartTooltip.module.css';
|
|
|
|
import ReactTooltip from 'react-tooltip';
|
|
|
|
|
|
|
|
export default function ChartTooltip({ chartId, tooltip }) {
|
|
|
|
if (!tooltip) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { title, value, label, labelColor } = tooltip;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ReactTooltip id={`${chartId}-tooltip`}>
|
|
|
|
<div className={styles.tooltip}>
|
|
|
|
<div className={styles.content}>
|
|
|
|
<div className={styles.title}>{title}</div>
|
|
|
|
<div className={styles.metric}>
|
2023-02-02 03:39:54 +01:00
|
|
|
<StatusLight color={labelColor}>
|
|
|
|
{value} {label}
|
|
|
|
</StatusLight>
|
2020-10-15 07:09:00 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</ReactTooltip>
|
|
|
|
);
|
|
|
|
}
|