Updated progress bars

This commit is contained in:
2026-02-14 17:19:22 -05:00
parent bcc5de6d7e
commit 61cceb41ba
11 changed files with 34 additions and 99 deletions

View File

@@ -1,9 +1,9 @@
import type { ProgressProps } from "$/types/ProgressTypes";
import clsx from "clsx";
import { forwardRef, useMemo } from "react";
import { useMemo } from "react";
const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
export default function Progress({
id,
className,
value,
@@ -15,7 +15,7 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
tabIndex,
progressColor,
backgroundColor
}, ref ) => {
}: Readonly<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;
@@ -55,7 +55,6 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
aria-valuenow={value ? Math.round(value * 10000) / 100 : undefined}
aria-label={label}
tabIndex={tabIndex ?? 0}
ref={ref}
>
<div
className={clsx(
@@ -77,8 +76,4 @@ const Progress = forwardRef<HTMLDivElement, ProgressProps>(({
/>
</div>
);
});
Progress.displayName = "Progress";
export default Progress;
}