[skip ci] Initial commit — CodexBar Mobile Expo app
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { View } from "react-native";
|
||||
|
||||
interface ProgressBarProps {
|
||||
percent: number;
|
||||
}
|
||||
|
||||
function getBarColor(percent: number): string {
|
||||
if (percent >= 85) return "bg-red-500";
|
||||
if (percent >= 60) return "bg-yellow-400";
|
||||
return "bg-green-500";
|
||||
}
|
||||
|
||||
export function ProgressBar({ percent }: ProgressBarProps) {
|
||||
const clamped = Math.max(0, Math.min(100, percent));
|
||||
return (
|
||||
<View className="h-2.5 w-full rounded-full bg-neutral-200 dark:bg-neutral-700">
|
||||
<View
|
||||
className={`h-2.5 rounded-full ${getBarColor(clamped)}`}
|
||||
style={{ width: `${clamped}%` }}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user