From 9d7da52ee343624574b112c2565c3bd43ac9ce1b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Mon, 28 Jan 2019 18:35:55 -0500 Subject: [PATCH] Adding Pin rendering component --- src/rendering/Pin/index.js | 21 +++++++++++++++++++++ src/rendering/Pin/style.js | 9 +++++++++ src/rendering/types.js | 2 ++ src/syntax/js.js | 6 ++++++ src/syntax/pcre.js | 6 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/rendering/Pin/index.js create mode 100644 src/rendering/Pin/style.js diff --git a/src/rendering/Pin/index.js b/src/rendering/Pin/index.js new file mode 100644 index 0000000..b70e648 --- /dev/null +++ b/src/rendering/Pin/index.js @@ -0,0 +1,21 @@ +import React from 'react'; + +import * as style from './style'; + +const radius = 5; + +const Pin = () => ; + +const layout = data => { + data.box = { + width: radius * 2, + height: radius * 2 + }; + return data; +}; + +export default Pin; +export { layout }; diff --git a/src/rendering/Pin/style.js b/src/rendering/Pin/style.js new file mode 100644 index 0000000..528d7dc --- /dev/null +++ b/src/rendering/Pin/style.js @@ -0,0 +1,9 @@ +import { + brown, + strokeBase +} from 'rendering/style'; + +export const pin = { + fill: brown, + ...strokeBase +}; diff --git a/src/rendering/types.js b/src/rendering/types.js index 763d888..709458f 100644 --- a/src/rendering/types.js +++ b/src/rendering/types.js @@ -1,10 +1,12 @@ import * as SVG from 'rendering/SVG'; +import * as Pin from 'rendering/Pin'; import * as Text from 'rendering/Text'; import * as Box from 'rendering/Box'; import * as HorizontalLayout from 'rendering/HorizontalLayout'; export default { SVG, + Pin, Text, Box, HorizontalLayout diff --git a/src/syntax/js.js b/src/syntax/js.js index 83a7eb4..de69be5 100644 --- a/src/syntax/js.js +++ b/src/syntax/js.js @@ -11,6 +11,9 @@ const parse = expr => { withConnectors: true }, children: [ + { + type: 'Pin' + }, { type: 'Box', props: { @@ -38,6 +41,9 @@ const parse = expr => { ] } ] + }, + { + type: 'Pin' } ] } diff --git a/src/syntax/pcre.js b/src/syntax/pcre.js index 6877c50..37795ce 100644 --- a/src/syntax/pcre.js +++ b/src/syntax/pcre.js @@ -11,6 +11,9 @@ const parse = expr => { withConnectors: true }, children: [ + { + type: 'Pin' + }, { type: 'Box', props: { @@ -38,6 +41,9 @@ const parse = expr => { ] } ] + }, + { + type: 'Pin' } ] }