Skip to content

Commit d68d121

Browse files
committed
feat(ui): add validation for progress prop in ProgressBar
Add input validation to the ProgressBar component to ensure the progress prop is between 0 and 100. If invalid, log an error message to the console for debugging and robustness.
1 parent 7aa0013 commit d68d121

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/ui/progress-bar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ type ProgressBarProps = {
33
}
44

55
function ProgressBar({ progress }: ProgressBarProps) {
6+
if (progress < 0 || progress > 100) {
7+
console.error('ProgressBar: progress must be between 0 and 100, received:', progress)
8+
}
9+
610
return (
711
<div className="flex items-center">
812
<div className="flex-1 h-1.5 bg-brand-100 rounded-full overflow-hidden">

0 commit comments

Comments
 (0)