1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/common/PercentageCircle/PercentageCircle.tsx
olav 2e367b3a04 feat: add trial expiration warning banner (#985)
* refactor: simplify useApiGetter cache keys

* refactor: simplify basePath helpers

* refactor: add UNLEASH_BASE_PATH frontend env var

* refactor: make sure AnnouncerElement does not affect the layout

* refactor: draw texture image above footer

* refactor: extract domain check helpers

* refactor: fix a few ts-expect-errors

* feat: add trial expiration warning banner

* refactor: fix IInstanceStatus interface prefix

* refactor: use ConditionallyRender in InstanceStatus

* refactor: simplify env helper functions

* refactor: use FC in InstanceStatus

* refactor: warn about expired trials

* refactor: fix eslint warnings

* refactor: disable banner outside of localhost

* refactor: use new instance state field name
2022-05-19 14:06:18 +02:00

49 lines
1.1 KiB
TypeScript

import { useTheme } from '@mui/material';
interface IPercentageCircleProps {
styles?: object;
percentage: number;
secondaryPieColor?: string;
className?: string;
}
const PercentageCircle = ({
styles,
percentage,
secondaryPieColor,
...rest
}: IPercentageCircleProps) => {
const theme = useTheme();
let circle = {
height: '65px',
width: '65px',
borderRadius: '50%',
color: '#fff',
backgroundColor: theme.palette.grey[200],
backgroundImage: `conic-gradient(${
theme.palette.primary.light
} ${percentage}%, ${secondaryPieColor || theme.palette.grey[200]} 1%)`,
};
if (percentage === 100) {
return (
<div
style={{
...circle,
...styles,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
100%
</div>
);
}
return <div style={{ ...circle, ...styles }} {...rest} />;
};
export default PercentageCircle;