mirror of
https://github.com/fankes/komari-theme-purcarte.git
synced 2025-10-18 19:39:22 +08:00
fix: 修复进度条组件的样式问题
This commit is contained in:
@@ -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>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user