Updated menus, chart tooltips, styles.

This commit is contained in:
Mike Cao 2025-05-05 01:36:16 -07:00
parent 0a16ab38e4
commit 92b283486e
23 changed files with 179 additions and 208 deletions

View file

@ -1,8 +1,6 @@
import { StatusLight } from '@umami/react-zen';
import { Row, StatusLight, Text } from '@umami/react-zen';
import { colord } from 'colord';
import classNames from 'classnames';
import { LegendItem } from 'chart.js/auto';
import styles from './Legend.module.css';
export function Legend({
items = [],
@ -16,21 +14,21 @@ export function Legend({
}
return (
<div className={styles.legend}>
<Row gap wrap="wrap" justifyContent="center">
{items.map(item => {
const { text, fillStyle, hidden } = item;
const color = colord(fillStyle);
return (
<div
key={text}
className={classNames(styles.label, { [styles.hidden]: hidden })}
onClick={() => onClick(item)}
>
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>{text}</StatusLight>
</div>
<Row key={text} onClick={() => onClick(item)}>
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>
<Text size="1" color={hidden ? 'disabled' : undefined} wrap="nowrap">
{text}
</Text>
</StatusLight>
</Row>
);
})}
</div>
</Row>
);
}