1
0
Fork 0

refactor: The Draft component is renamed to Render. Draft is deprecated

This commit is contained in:
Joost De Cock 2019-11-01 17:34:54 +01:00
parent 7bc22909b7
commit 1af55d9e22
24 changed files with 8 additions and 6 deletions

View file

@ -1,40 +0,0 @@
import React from "react";
import PropTypes from "prop-types";
import { strings } from "@freesewing/i18n";
const TextOnPath = props => {
let text = [];
// Handle translation
let translated = "";
for (let string of props.path.attributes.getAsArray("data-text")) {
if (strings[props.language]["plugin." + string])
translated += strings[props.language]["plugin." + string];
else translated += string;
translated += " ";
}
let textPathProps = {
xlinkHref: "#" + props.pathId,
startOffset: "0%"
};
let align = props.path.attributes.get("data-text-class");
if (align && align.indexOf("center") > -1) textPathProps.startOffset = "50%";
else if (align && align.indexOf("right") > -1)
textPathProps.startOffset = "100%";
return (
<text>
<textPath {...textPathProps}>
<tspan {...props.path.attributes.asPropsIfPrefixIs("data-text-")}>
{translated}
</tspan>
</textPath>
</text>
);
};
TextOnPath.propTypes = {
path: PropTypes.object.isRequired,
language: PropTypes.string.isRequired
};
export default TextOnPath;