fix: 修复进度条组件的样式问题

This commit is contained in:
Montia37
2025-09-08 18:50:07 +08:00
parent b1405376a0
commit dc939228b2

View File

@@ -8,12 +8,19 @@ export const ProgressBar = ({
value: number; value: number;
h?: string; h?: string;
className?: string; className?: string;
}) => ( }) => {
<div className={`w-full bg-(--accent-4)/50 rounded-full ${h}`}> const clampedValue = Math.max(0, Math.min(100, value));
const progressRoundedClass =
clampedValue < 10 ? "rounded-sm" : "rounded-full";
return (
<div <div
className={`${h} rounded-full transition-all duration-500 ${getProgressBarClass( className={`w-full bg-(--accent-4)/50 rounded-full ${h} overflow-hidden`}>
value <div
)} ${className}`} className={`${h} ${progressRoundedClass} transition-all duration-500 ${getProgressBarClass(
style={{ width: `${value}%` }}></div> clampedValue
</div> )} ${className}`}
); style={{ width: `${clampedValue}%` }}></div>
</div>
);
};