import { Table } from "@radix-ui/themes"; import type { CellProps } from "@radix-ui/themes/components/table"; export enum CompareCellDirection { HIGHER_IS_BETTER, LOWER_IS_BETTER, } interface CompareCellProps extends CellProps { value: number; truth: number; direction?: CompareCellDirection; } export function CompareCell({ value, truth, style, direction = CompareCellDirection.HIGHER_IS_BETTER, ...props }: CompareCellProps) { const percentage = value / truth - 1; const shiftedPercentage = Math.round( Math.min(100, Math.abs(percentage) * 2 * 100 + 25) ); return (