forked from github/plane
* chore: module constant and helper function added * style: module card ui revamp * chore: custom media query added * chore: circular progress indicator added * chore: module card item ui improvement * chore: module list view added * chore: module sidebar added in list and card view * chore: module list and card ui improvement * chore: module sidebar select, avatar and link list component improvement * chore: sidebar improvement and refactor * style: module sidebar revamp * style: module sidebar ui improvement * chore: module sidebar lead and member select improvement * style: module sidebar progress section empty state added * chore: module card issue count validation added * style: module card and list item ui improvement
103 lines
3.0 KiB
TypeScript
103 lines
3.0 KiB
TypeScript
import React, { Children } from "react";
|
|
|
|
interface ICircularProgressIndicator {
|
|
size: number;
|
|
percentage: number;
|
|
strokeWidth?: number;
|
|
strokeColor?: string;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export const CircularProgressIndicator: React.FC<ICircularProgressIndicator> = (
|
|
props
|
|
) => {
|
|
const { size = 40, percentage = 25, strokeWidth = 6, children } = props;
|
|
|
|
const sqSize = size;
|
|
const radius = (size - strokeWidth) / 2;
|
|
const viewBox = `0 0 ${sqSize} ${sqSize}`;
|
|
const dashArray = radius * Math.PI * 2;
|
|
const dashOffset = dashArray - (dashArray * percentage) / 100;
|
|
return (
|
|
<div className="relative">
|
|
<svg width={size} height={size} viewBox={viewBox} fill="none">
|
|
<circle
|
|
className="fill-none stroke-custom-background-80"
|
|
cx={size / 2}
|
|
cy={size / 2}
|
|
r={radius}
|
|
strokeWidth={`${strokeWidth}px`}
|
|
style={{ filter: "url(#filter0_bi_377_19141)" }}
|
|
/>
|
|
<defs>
|
|
<filter
|
|
id="filter0_bi_377_19141"
|
|
x="-3.57544"
|
|
y="-3.57422"
|
|
width="45.2227"
|
|
height="45.2227"
|
|
filterUnits="userSpaceOnUse"
|
|
color-interpolation-filters="sRGB"
|
|
>
|
|
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
|
<feGaussianBlur in="BackgroundImageFix" stdDeviation="2" />
|
|
<feComposite
|
|
in2="SourceAlpha"
|
|
operator="in"
|
|
result="effect1_backgroundBlur_377_19141"
|
|
/>
|
|
<feBlend
|
|
mode="normal"
|
|
in="SourceGraphic"
|
|
in2="effect1_backgroundBlur_377_19141"
|
|
result="shape"
|
|
/>
|
|
<feColorMatrix
|
|
in="SourceAlpha"
|
|
type="matrix"
|
|
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
result="hardAlpha"
|
|
/>
|
|
<feOffset dx="1" dy="1" />
|
|
<feGaussianBlur stdDeviation="2" />
|
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
|
|
<feColorMatrix
|
|
type="matrix"
|
|
values="0 0 0 0 0.63125 0 0 0 0 0.6625 0 0 0 0 0.75 0 0 0 0.35 0"
|
|
/>
|
|
<feBlend
|
|
mode="normal"
|
|
in2="shape"
|
|
result="effect2_innerShadow_377_19141"
|
|
/>
|
|
</filter>
|
|
</defs>
|
|
<circle
|
|
className="stroke-custom-primary-100 fill-none "
|
|
cx={size / 2}
|
|
cy={size / 2}
|
|
r={radius}
|
|
strokeWidth={`${strokeWidth}px`}
|
|
transform={`rotate(-90 ${size / 2} ${size / 2})`}
|
|
style={{
|
|
strokeDasharray: dashArray,
|
|
strokeDashoffset: dashOffset,
|
|
}}
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
/>
|
|
</svg>
|
|
<div
|
|
className="absolute"
|
|
style={{
|
|
top: "50%",
|
|
left: "50%",
|
|
transform: "translate(-50%, -50%)",
|
|
}}
|
|
>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|