mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-02 10:39:56 +00:00
043b522ff1
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update src/shared/utils/app/convert-comment-sort-type.ts Co-authored-by: SleeplessOne1917 <abias1122@gmail.com> * prettier pass --------- Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
44 lines
978 B
TypeScript
44 lines
978 B
TypeScript
import { ThemeColor } from "@utils/types";
|
|
import classNames from "classnames";
|
|
|
|
interface ProgressBarProps {
|
|
className?: string;
|
|
backgroundColor?: ThemeColor;
|
|
barColor?: ThemeColor;
|
|
striped?: boolean;
|
|
animated?: boolean;
|
|
min?: number;
|
|
max?: number;
|
|
value: number;
|
|
text?: string;
|
|
}
|
|
|
|
const ProgressBar = ({
|
|
value,
|
|
animated = false,
|
|
backgroundColor = "secondary",
|
|
barColor = "primary",
|
|
className,
|
|
max = 100,
|
|
min = 0,
|
|
striped = false,
|
|
text,
|
|
}: ProgressBarProps) => (
|
|
<div className={classNames("progress", `bg-${backgroundColor}`, className)}>
|
|
<div
|
|
className={classNames("progress-bar", `bg-${barColor}`, {
|
|
"progress-bar-striped": striped,
|
|
"progress-bar-animated": animated,
|
|
})}
|
|
role="progressbar"
|
|
aria-valuemin={min}
|
|
aria-valuemax={max}
|
|
aria-valuenow={value}
|
|
style={`width: ${((value - min) / max) * 100}%;`}
|
|
>
|
|
{text}
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
export default ProgressBar;
|