import type { ProgressProps } from "$/types/ProgressTypes"; import clsx from "clsx"; import { useMemo } from "react"; export default function Progress({ id, className, value, min, max, size = "md", rounding = "full", label, tabIndex, progressColor, backgroundColor }: ProgressProps){ const percentage = useMemo(() => { const num = !value || Number.isNaN(value) ? min : Math.max(value, min); const den = (!value || Number.isNaN(value) ? max : Math.max(value, max)) - min; const percentage = (num / den) * 100; return percentage && percentage > max ? max : percentage; }, [ min, max, value ]); return (
); }