diff --git a/packages/components/src/Example/bak.js b/packages/components/src/Example/bak.js deleted file mode 100644 index e81a3810a8a..00000000000 --- a/packages/components/src/Example/bak.js +++ /dev/null @@ -1,130 +0,0 @@ -import React, { useState } from "react"; -import PropTypes from "prop-types"; -import examples from "@freesewing/examples"; -import rendertest from "@freesewing/rendertest"; -import i18nPlugin from "@freesewing/plugin-i18n"; -import Draft from "../Draft"; -import Design from "../Workbench/Design"; -import { FormattedMessage } from "react-intl"; -import IconButton from "@material-ui/core/IconButton"; -import DesignIcon from "@material-ui/icons/LocationSearching"; -import CodeIcon from "@material-ui/icons/Code"; -import ResetIcon from "@material-ui/icons/SettingsBackupRestore"; -import Prism from "prismjs"; - -const Example = props => { - const [design, setDesign] = useState(false); - const [code, setCode] = useState(false); - const [focus, setFocus] = useState(null); - - const raiseEvent = (type, data) => { - if (type === "clearFocusAll") return setFocus(null); - let f = {}; - if (focus !== null) f = { ...focus }; - if (typeof f[data.part] === "undefined") - f[data.part] = { paths: [], points: [], coords: [] }; - if (type === "point") f[data.part].points.push(data.name); - else if (type === "path") f[data.part].paths.push(data.name); - else if (type === "coords") f[data.part].coords.push(data.coords); - else if (type === "clearFocus") { - let i = focus[data.part][data.type].indexOf(data.name); - f[data.part][data.type].splice(i, 1); - } - - setFocus(f); - }; - - let focusCount = 0; - if (focus !== null) { - for (let p of Object.keys(focus)) { - for (let i in focus[p].points) focusCount++; - for (let i in focus[p].paths) focusCount++; - for (let i in focus[p].coords) focusCount++; - } - } - - const patterns = { - examples, - rendertest - }; - const settings = { options: { ...props.options } }; - if (props.part !== "") settings.only = [props.part]; - const pattern = new patterns[props.pattern](settings); - - pattern.draft(); - console.log(props); - const patternProps = pattern.getRenderProps(); - return ( -
-
-
- {design ? ( - raiseEvent("clearFocusAll", null)} - > - - - ) : null} - setDesign(!design)} - > - - - setCode(!code)} - > - - -
- -
-
{props.caption}
- {design ? ( -
- -
- ) : null} - {code ? ( -
-
-            hi
-          
-
- ) : null} -
- ); -}; - -Example.propTypes = { - pattern: PropTypes.string, - design: PropTypes.bool, - caption: PropTypes.string, - part: PropTypes.string, - options: PropTypes.obj -}; - -Example.defaultProps = { - pattern: "examples", - design: false, - caption: "", - options: {}, - part: "" -}; - -export default Example; diff --git a/packages/components/src/Example/index.js b/packages/components/src/Example/index.js index 402e815dfad..93ef299e61a 100644 --- a/packages/components/src/Example/index.js +++ b/packages/components/src/Example/index.js @@ -2,10 +2,8 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; import examples from "@freesewing/examples"; import rendertest from "@freesewing/rendertest"; -import i18nPlugin from "@freesewing/plugin-i18n"; import Draft from "../Draft"; import Design from "../Workbench/Design"; -import { FormattedMessage } from "react-intl"; import IconButton from "@material-ui/core/IconButton"; import ResetIcon from "@material-ui/icons/SettingsBackupRestore"; import Switch from "@material-ui/core/Switch"; @@ -48,12 +46,6 @@ const Example = props => { if (props.part !== "") settings.only = [props.part]; const pattern = new patterns[props.pattern](settings); - const style = { - thumb: { - background: "blue" - } - }; - pattern.draft(); const patternProps = pattern.getRenderProps(); return ( diff --git a/packages/examples/src/index.js b/packages/examples/src/index.js index 1a9b87e176d..12bccadd1cf 100644 --- a/packages/examples/src/index.js +++ b/packages/examples/src/index.js @@ -103,7 +103,6 @@ let methods = { draftPath_join, draftPath_length, draftPath_offset, - draftPath_ops, draftPath_reverse, draftPath_shiftalong, draftPath_shiftfractionalong, diff --git a/packages/examples/src/point_dist.js b/packages/examples/src/point_dist.js index 350a46a516b..3fd705a6357 100644 --- a/packages/examples/src/point_dist.js +++ b/packages/examples/src/point_dist.js @@ -1,5 +1,5 @@ export default part => { - let { Point, points, Snippet, snippets, macro } = part.shorthand(); + let { Point, points, macro } = part.shorthand(); points.from = new Point(10, 10); points.to = new Point(90, 40); diff --git a/packages/examples/src/point_dx.js b/packages/examples/src/point_dx.js index cea283ed357..3e4c0326b5e 100644 --- a/packages/examples/src/point_dx.js +++ b/packages/examples/src/point_dx.js @@ -1,5 +1,5 @@ export default part => { - let { Point, points, Snippet, snippets, macro } = part.shorthand(); + let { Point, points, macro } = part.shorthand(); points.from = new Point(10, 10); points.to = new Point(90, 40); diff --git a/packages/examples/src/point_dy.js b/packages/examples/src/point_dy.js index 4a86062bd22..27b18d8a121 100644 --- a/packages/examples/src/point_dy.js +++ b/packages/examples/src/point_dy.js @@ -1,5 +1,5 @@ export default part => { - let { Point, points, Snippet, snippets, macro } = part.shorthand(); + let { Point, points, macro } = part.shorthand(); points.from = new Point(10, 10); points.to = new Point(90, 40); diff --git a/packages/examples/src/point_rotate.js b/packages/examples/src/point_rotate.js index b66e1473279..9c6ccc62efb 100644 --- a/packages/examples/src/point_rotate.js +++ b/packages/examples/src/point_rotate.js @@ -1,5 +1,5 @@ export default part => { - let { Point, points, Path, paths, Snippet, snippets } = part.shorthand(); + let { Point, points, Path, paths } = part.shorthand(); points.sun = new Point(40, 40); points.moon = new Point(70, 40);