|
@ -10,12 +10,6 @@ interface CircleProps extends ProgressProps { |
|
|
progressStatus: string; |
|
|
progressStatus: string; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const statusColorMap: Record<string, string> = { |
|
|
|
|
|
normal: '#108ee9', |
|
|
|
|
|
exception: '#ff5500', |
|
|
|
|
|
success: '#87d068', |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function getPercentage({ percent, successPercent }: CircleProps) { |
|
|
function getPercentage({ percent, successPercent }: CircleProps) { |
|
|
const ptg = validProgress(percent); |
|
|
const ptg = validProgress(percent); |
|
|
if (!successPercent) { |
|
|
if (!successPercent) { |
|
@ -26,12 +20,12 @@ function getPercentage({ percent, successPercent }: CircleProps) { |
|
|
return [successPercent, validProgress(ptg - successPtg)]; |
|
|
return [successPercent, validProgress(ptg - successPtg)]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getStrokeColor({ progressStatus, successPercent, strokeColor }: CircleProps) { |
|
|
function getStrokeColor({ successPercent, strokeColor }: CircleProps) { |
|
|
const color = strokeColor || statusColorMap[progressStatus]; |
|
|
const color = strokeColor || null; |
|
|
if (!successPercent) { |
|
|
if (!successPercent) { |
|
|
return color; |
|
|
return color; |
|
|
} |
|
|
} |
|
|
return [statusColorMap.success, color]; |
|
|
return [null, color]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const Circle: React.SFC<CircleProps> = props => { |
|
|
const Circle: React.SFC<CircleProps> = props => { |
|
|