Adding Pin rendering component

This commit is contained in:
Jeff Avallone 2019-01-28 18:35:55 -05:00
parent 4e27c4ef87
commit 9d7da52ee3
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import React from 'react';
import * as style from './style';
const radius = 5;
const Pin = () => <circle
style={ style.pin }
r={ radius }
transform={ `translate(${ radius } ${ radius })` }/>;
const layout = data => {
data.box = {
width: radius * 2,
height: radius * 2
};
return data;
};
export default Pin;
export { layout };

View File

@ -0,0 +1,9 @@
import {
brown,
strokeBase
} from 'rendering/style';
export const pin = {
fill: brown,
...strokeBase
};

View File

@ -1,10 +1,12 @@
import * as SVG from 'rendering/SVG'; import * as SVG from 'rendering/SVG';
import * as Pin from 'rendering/Pin';
import * as Text from 'rendering/Text'; import * as Text from 'rendering/Text';
import * as Box from 'rendering/Box'; import * as Box from 'rendering/Box';
import * as HorizontalLayout from 'rendering/HorizontalLayout'; import * as HorizontalLayout from 'rendering/HorizontalLayout';
export default { export default {
SVG, SVG,
Pin,
Text, Text,
Box, Box,
HorizontalLayout HorizontalLayout

View File

@ -11,6 +11,9 @@ const parse = expr => {
withConnectors: true withConnectors: true
}, },
children: [ children: [
{
type: 'Pin'
},
{ {
type: 'Box', type: 'Box',
props: { props: {
@ -38,6 +41,9 @@ const parse = expr => {
] ]
} }
] ]
},
{
type: 'Pin'
} }
] ]
} }

View File

@ -11,6 +11,9 @@ const parse = expr => {
withConnectors: true withConnectors: true
}, },
children: [ children: [
{
type: 'Pin'
},
{ {
type: 'Box', type: 'Box',
props: { props: {
@ -38,6 +41,9 @@ const parse = expr => {
] ]
} }
] ]
},
{
type: 'Pin'
} }
] ]
} }