on 04765bb help sign in
bridge/src/_walletgen/components/ReactSVGComponents.js
79 lines 1.7 kB history raw
1import React from 'react';
2import { get, map } from 'lodash';
4const ReactSVGComponents = {
5 svg: p => {
6 return (
7 <svg {...p.attr} version={'1.1'} xmlns={'http://www.w3.org/2000/svg'}>
8 {map(get(p, 'children', []), child =>
9 ReactSVGComponents[child.tag](child)
10 )}
11 </svg>
12 );
13 },
14 circle: p => {
15 return (
16 <circle {...p.attr}>
17 {map(get(p, 'children', []), child =>
18 ReactSVGComponents[child.tag](child)
19 )}
20 </circle>
21 );
22 },
23 rect: p => {
24 return (
25 <rect {...p.attr}>
26 {map(get(p, 'children', []), child =>
27 ReactSVGComponents[child.tag](child)
28 )}
29 </rect>
30 );
31 },
32 path: p => {
33 return (
34 <path {...p.attr}>
35 {map(get(p, 'children', []), child =>
36 ReactSVGComponents[child.tag](child)
37 )}
38 </path>
39 );
40 },
41 g: p => {
42 return (
43 <g {...p.attr}>
44 {map(get(p, 'children', []), child =>
45 ReactSVGComponents[child.tag](child)
46 )}
47 </g>
48 );
49 },
50 polygon: p => {
51 return (
52 <polygon {...p.attr}>
53 {map(get(p, 'children', []), child =>
54 ReactSVGComponents[child.tag](child)
55 )}
56 </polygon>
57 );
58 },
59 line: p => {
60 return (
61 <line {...p.attr}>
62 {map(get(p, 'children', []), child =>
63 ReactSVGComponents[child.tag](child)
64 )}
65 </line>
66 );
67 },
68 polyline: p => {
69 return (
70 <polyline {...p.attr}>
71 {map(get(p, 'children', []), child =>
72 ReactSVGComponents[child.tag](child)
73 )}
74 </polyline>
75 );
76 },
77};
79export default ReactSVGComponents;