diff --git a/src/layout.js b/src/layout.js
index bc164d9..1c87341 100644
--- a/src/layout.js
+++ b/src/layout.js
@@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import SVG from 'rendering/SVG/layout';
-import Text from 'rendering/Text/layout';
+import * as SVG from 'rendering/SVG';
+import * as Text from 'rendering/Text';
const nodeTypes = {
SVG,
@@ -20,7 +20,7 @@ const layout = data => {
data.children = data.children.map(layout);
}
- return nodeTypes[type]({
+ return nodeTypes[type].layout({
props: {},
...data
});
diff --git a/src/rendering/SVG/index.js b/src/rendering/SVG/index.js
index 631a6b2..551fa08 100644
--- a/src/rendering/SVG/index.js
+++ b/src/rendering/SVG/index.js
@@ -47,4 +47,14 @@ SVG.propTypes = {
innerHeight: PropTypes.number
};
+const layout = data => {
+ const child = data.children[0];
+
+ data.props.innerWidth = child.box.width;
+ data.props.innerHeight = child.box.height;
+
+ return data;
+};
+
export default SVG;
+export { layout };
diff --git a/src/rendering/SVG/layout.js b/src/rendering/SVG/layout.js
deleted file mode 100644
index 929f69b..0000000
--- a/src/rendering/SVG/layout.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const layoutSVG = data => {
- const child = data.children[0];
-
- data.props.innerWidth = child.box.width;
- data.props.innerHeight = child.box.height;
-
- return data;
-};
-
-export default layoutSVG;
diff --git a/src/rendering/Text/index.js b/src/rendering/Text/index.js
index cbf1bf3..8f5d6d1 100644
--- a/src/rendering/Text/index.js
+++ b/src/rendering/Text/index.js
@@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { getBBox } from 'layout';
+
import * as style from './style';
const Text = ({ transform, quoted, children }) => {
@@ -27,4 +29,14 @@ Text.propTypes = {
]).isRequired
};
+const layout = data => {
+ const {x, y, width, height } = getBBox(
+ { data.children });
+
+ data.box = { width, height };
+ data.props.transform = `translate(${ -x } ${ -y })`;
+ return data;
+};
+
export default Text;
+export { layout };
diff --git a/src/rendering/Text/layout.js b/src/rendering/Text/layout.js
deleted file mode 100644
index da1cdff..0000000
--- a/src/rendering/Text/layout.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-
-import { getBBox } from 'layout';
-import Text from 'rendering/Text';
-
-const layoutText = data => {
- const {x, y, width, height } = getBBox(
- { data.children });
-
- data.box = { width, height };
- data.props.transform = `translate(${ -x } ${ -y })`;
- return data;
-};
-
-export default layoutText;