-
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Unleash/unleash into client…
…-instance-service
- Loading branch information
Showing
21 changed files
with
226 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
frontend/src/component/common/PercentageCircle/DisabledPercentageCircle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useTheme } from '@mui/material'; | ||
import { CSSProperties } from 'react'; | ||
|
||
interface IPercentageCircleProps { | ||
percentage: number; | ||
size?: `${number}rem`; | ||
} | ||
|
||
const PercentageCircle = ({ | ||
percentage, | ||
size = '4rem', | ||
}: IPercentageCircleProps) => { | ||
const theme = useTheme(); | ||
|
||
const style: CSSProperties = { | ||
display: 'block', | ||
borderRadius: '100%', | ||
transform: 'rotate(-90deg)', | ||
height: size, | ||
width: size, | ||
background: theme.palette.background.elevation2, | ||
}; | ||
|
||
// The percentage circle used to be drawn by CSS with a conic-gradient, | ||
// but the result was either jagged or blurry. SVG seems to look better. | ||
// See https://stackoverflow.com/a/70659532. | ||
const radius = 100 / (2 * Math.PI); | ||
const diameter = 2 * radius; | ||
|
||
return ( | ||
<svg viewBox={`0 0 ${diameter} ${diameter}`} style={style} aria-hidden> | ||
<title>A circle progress bar with {percentage}% completion.</title> | ||
<circle | ||
r={radius} | ||
cx={radius} | ||
cy={radius} | ||
fill='none' | ||
stroke={theme.palette.neutral.border} | ||
strokeWidth={diameter} | ||
strokeDasharray={`${percentage} 100`} | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default PercentageCircle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.