import React from 'react'; interface ProgressProps { percent: number; type?: 'line' | 'circle'; size?: number; strokeColor?: string; strokeWidth?: number; showInfo?: boolean; isDarkMode?: boolean; className?: string; } const Progress: React.FC = ({ percent, type = 'line', size = 24, strokeColor = '#1890ff', strokeWidth = 2, showInfo = true, isDarkMode = false, className = '', }) => { // Ensure percent is between 0 and 100 const normalizedPercent = Math.min(Math.max(percent, 0), 100); if (type === 'circle') { const radius = (size - strokeWidth) / 2; const circumference = radius * 2 * Math.PI; const strokeDasharray = circumference; const strokeDashoffset = circumference - (normalizedPercent / 100) * circumference; return (
{showInfo && ( {normalizedPercent}% )}
); } return (
{showInfo && (
{normalizedPercent}%
)}
); }; export default Progress;