wix-style-react
Version:
wix-style-react
18 lines • 768 B
JavaScript
import * as React from 'react';
const arc = (r, value) => {
value /= 100;
const angle = 2 * Math.PI * (value - 1 / 4);
const x = r * Math.cos(angle);
const y = r * Math.sin(angle);
const sweep = Math.round(value);
return `M .01 ${-r} A ${r} ${r} 0 ${sweep} 1 ${x} ${y}`;
};
export const Arc = (props) => {
const { value, strokeWidth, size, className } = props;
const viewBox = `${-size / 2} ${-size / 2} ${size} ${size}`;
const d = arc((size - strokeWidth) / 2, value);
return (React.createElement("svg", { className: className, width: size, height: size, viewBox: viewBox },
React.createElement("path", { d: d, strokeWidth: value !== 0 ? strokeWidth : 0 })));
};
Arc.displayName = 'Arc';
//# sourceMappingURL=Arc.js.map