diff --git a/components/spin/Indicator/Progress.tsx b/components/spin/Indicator/Progress.tsx index c1d4a195b1..a784d21978 100644 --- a/components/spin/Indicator/Progress.tsx +++ b/components/spin/Indicator/Progress.tsx @@ -7,7 +7,35 @@ export interface ProgressProps { percent: number; } -export default function Progress({ percent, prefixCls }: ProgressProps) { +const viewSize = 100; +const borderWidth = viewSize / 5; +const radius = viewSize / 2 - borderWidth / 2; +const circumference = radius * 2 * Math.PI; +const position = 50; + +interface CircleProps { + dotClassName?: string; + style?: React.CSSProperties; + hasCircleCls?: boolean; +} + +const CustomCircle: React.FC> = (props) => { + const { dotClassName, style, hasCircleCls } = props; + return ( + + ); +}; + +const Progress: React.FC> = ({ percent, prefixCls }) => { const dotClassName = `${prefixCls}-dot`; const holderClassName = `${dotClassName}-holder`; const hideClassName = `${holderClassName}-hidden`; @@ -24,27 +52,18 @@ export default function Progress({ percent, prefixCls }: ProgressProps) { // ==================== Progress ==================== const safePtg = Math.max(Math.min(percent, 100), 0); - const viewSize = 100; - const borderWidth = viewSize / 5; - const radius = viewSize / 2 - borderWidth / 2; - const circumference = radius * 2 * Math.PI; - - const renderCircle = (circleClassName?: string, style?: React.CSSProperties) => ( - - ); - // ===================== Render ===================== if (!render) { return null; } + const circleStyle: React.CSSProperties = { + strokeDashoffset: `${circumference / 4}`, + strokeDasharray: `${(circumference * safePtg) / 100} ${ + (circumference * (100 - safePtg)) / 100 + }`, + }; + return ( - {renderCircle(`${dotClassName}-circle-bg`)} - {renderCircle('', { - strokeDasharray: `${(circumference * safePtg) / 100} ${ - (circumference * (100 - safePtg)) / 100 - }`, - strokeDashoffset: `${circumference / 4}`, - })} + + ); -} +}; + +export default Progress; diff --git a/components/spin/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/spin/__tests__/__snapshots__/demo-extend.test.ts.snap index 3eaf3e0168..6206003d69 100644 --- a/components/spin/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/spin/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -370,7 +370,7 @@ exports[`renders components/spin/demo/percent.tsx extend context correctly 1`] = viewBox="0 0 100 100" > @@ -423,7 +423,7 @@ exports[`renders components/spin/demo/percent.tsx extend context correctly 1`] = viewBox="0 0 100 100" > @@ -476,7 +476,7 @@ exports[`renders components/spin/demo/percent.tsx extend context correctly 1`] = viewBox="0 0 100 100" >