| Conditions | 2 |
| Total Lines | 33 |
| Code Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import React from "react"; |
||
| 30 | |||
| 31 | public render(): React.ReactElement { |
||
| 32 | const { radius, stroke, progress, strokeColor, max } = this.props; |
||
| 33 | const { normalizedRadius, circumference } = this.state; |
||
| 34 | |||
| 35 | let strokeDashoffset = circumference - (progress / max) * circumference; |
||
| 36 | if (strokeDashoffset < 0) { |
||
| 37 | strokeDashoffset = 0; |
||
| 38 | } |
||
| 39 | |||
| 40 | return ( |
||
| 41 | <svg height={radius * 2} width={radius * 2}> |
||
| 42 | <circle |
||
| 43 | stroke="grey" |
||
| 44 | fill="transparent" |
||
| 45 | strokeWidth={stroke} |
||
| 46 | strokeDasharray={`${circumference} ${circumference}`} |
||
| 47 | style={{ strokeDashoffset: 0 }} |
||
| 48 | r={normalizedRadius} |
||
| 49 | cx={radius} |
||
| 50 | cy={radius} |
||
| 51 | /> |
||
| 52 | <circle |
||
| 53 | stroke={strokeColor} |
||
| 54 | fill="transparent" |
||
| 55 | strokeWidth={stroke} |
||
| 56 | strokeDasharray={`${circumference} ${circumference}`} |
||
| 57 | style={{ strokeDashoffset }} |
||
| 58 | r={normalizedRadius} |
||
| 59 | cx={radius} |
||
| 60 | cy={radius} |
||
| 61 | /> |
||
| 62 | </svg> |
||
| 63 | ); |
||
| 68 |