import React from 'react'; import { IonProgressBar } from '@ionic/react'; interface CustomProgressBarProps { value: number; // 0 to 1 label?: string; statusText?: string; color?: string; // Hex, rgb, or css variable showPercent?: boolean; style?: React.CSSProperties; } export const CustomProgressBar: React.FC = ({ value, label, statusText, color = 'var(--ion-color-primary)', showPercent = true, style, }) => { const percentage = Math.round(Math.min(Math.max(value, 0), 1) * 100); return (
{/* Label and Status */} {(label || statusText || showPercent) && (
{label}{' '} {statusText && ( • {statusText} )} {showPercent && ( {percentage}% )}
)} {/* Progress Track */}
); }; export default CustomProgressBar;