UNPKG

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