import { Row, StatusLight, Text } from '@umami/react-zen'; import { colord } from 'colord'; import { LegendItem } from 'chart.js/auto'; export function Legend({ items = [], onClick, }: { items: any[]; onClick: (index: LegendItem) => void; }) { if (!items.find(({ text }) => text)) { return null; } return ( {items.map(item => { const { text, fillStyle, hidden } = item; const color = colord(fillStyle); return ( onClick(item)}> {text} ); })} ); }