diff --git a/src/rendering/Box/index.js b/src/rendering/Box/index.js index 9fc4498..b8e44d1 100644 --- a/src/rendering/Box/index.js +++ b/src/rendering/Box/index.js @@ -12,7 +12,6 @@ const Box = ({ width, height, rectTransform, - labelTransform, contentTransform, children }) => { @@ -24,14 +23,10 @@ const Box = ({ ry: radius, transform: rectTransform }; - const textProps = { - transform: labelTransform, - style: style.infoText - }; return <> - { label && { label } } + { label && { label } } { children } @@ -51,7 +46,6 @@ Box.propTypes = { width: PropTypes.number, height: PropTypes.number, rectTransform: PropTypes.string, - labelTransform: PropTypes.string, contentTransform: PropTypes.string, children: PropTypes.node }; @@ -75,7 +69,6 @@ const layout = data => { width: data.box.width, height: childBox.height + 2 * padding, rectTransform: `translate(0 ${ labelBox.height })`, - labelTransform: `translate(0 ${ labelBox.height })`, contentTransform: `translate(${ padding } ${ padding + labelBox.height })` }; return data; diff --git a/src/rendering/Box/style.js b/src/rendering/Box/style.js index ada161b..2562008 100644 --- a/src/rendering/Box/style.js +++ b/src/rendering/Box/style.js @@ -34,5 +34,5 @@ export const anchor = { export const infoText = { fontSize: fontSizeSmall, fontFamily: fontFamily, - dominantBaseline: 'text-after-edge' + dominantBaseline: 'text-before-edge' }; diff --git a/src/rendering/Text/index.js b/src/rendering/Text/index.js index a674555..dd44a41 100644 --- a/src/rendering/Text/index.js +++ b/src/rendering/Text/index.js @@ -5,13 +5,8 @@ import { getBBox } from 'layout'; import * as style from './style'; -const Text = ({ transform, quoted, theme, children }) => { - const textProps = { - style: { ...style.text, ...style[theme] }, - transform - }; - - return +const Text = ({ quoted, theme, children }) => { + return { quoted ? <> { children } @@ -23,7 +18,6 @@ const Text = ({ transform, quoted, theme, children }) => { Text.propTypes = { quoted: PropTypes.bool, theme: PropTypes.string, - transform: PropTypes.string, children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.node), PropTypes.node @@ -31,11 +25,10 @@ Text.propTypes = { }; const layout = data => { - const {x, y, width, height } = getBBox( + const { width, height } = getBBox( { data.children }); data.box = { width, height }; - data.props.transform = `translate(${ -x } ${ -y })`; return data; }; diff --git a/src/rendering/Text/style.js b/src/rendering/Text/style.js index 3c21a3e..4dfc18a 100644 --- a/src/rendering/Text/style.js +++ b/src/rendering/Text/style.js @@ -1,7 +1,8 @@ import { fontSize, fontFamily, white, grey } from 'rendering/style'; export const text = { - fontSize, fontFamily + fontSize, fontFamily, + dominantBaseline: 'text-before-edge' }; export const anchor = { fill: white