Updated progress bars
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user