refactor: The Draft component is renamed to Render. Draft is deprecated
This commit is contained in:
parent
7bc22909b7
commit
1af55d9e22
24 changed files with 8 additions and 6 deletions
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue