UNPKG

933 BTypeScriptView Raw
1import { jsx } from '../../jsx';
2
3export default (props) => {
4 const { coord, node } = props;
5 const { children } = node;
6 const { x, y } = coord.center;
7
8 const renderNodes = (nodes) => {
9 return (
10 <group>
11 {nodes.map((node) => {
12 const { xMin, xMax, yMin, yMax, color, children } = node;
13 return (
14 <group>
15 <sector
16 attrs={{
17 x,
18 y,
19 lineWidth: '1px',
20 stroke: '#fff',
21 startAngle: xMin,
22 endAngle: xMax,
23 r0: yMin,
24 r: yMax,
25 anticlockwise: false,
26 fill: color,
27 }}
28 />
29 {children && children.length ? renderNodes(children) : null}
30 </group>
31 );
32 })}
33 </group>
34 );
35 };
36
37 return renderNodes(children);
38};