diff --git a/package.json b/package.json
index ea61c29..89ffd89 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "constraint-layout",
+ "name": "react-constraint",
"version": "0.1.0",
"private": true,
"dependencies": {
diff --git a/src/App.tsx b/src/App.tsx
index 25fbcc4..585895b 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,7 +1,7 @@
import React from "react";
import "./App.css";
-import { simpleBlock } from "./constraints/example";
import { createLayoutComponent } from "./constraints/generator";
+import { vertices } from "./examples/vertices";
const codeStyle: React.CSSProperties = {
width: "50vw",
@@ -21,13 +21,13 @@ const viewStyle: React.CSSProperties = {
left: "50%"
};
-const Comp = createLayoutComponent(simpleBlock);
+const Comp = createLayoutComponent(vertices);
const App: React.FC = () => {
return (
<>
- {JSON.stringify(simpleBlock, null, 2)}
+ {JSON.stringify(vertices, null, 2)}
Hola} />
diff --git a/src/constraints/example.ts b/src/examples/simple.ts
similarity index 90%
rename from src/constraints/example.ts
rename to src/examples/simple.ts
index cc5a88c..6b48e4a 100644
--- a/src/constraints/example.ts
+++ b/src/examples/simple.ts
@@ -1,4 +1,4 @@
-import { LayoutDefinition } from "./definition";
+import { LayoutDefinition } from "../constraints/definition";
export const simpleBlock: LayoutDefinition = {
Block: {
diff --git a/src/examples/vertices.ts b/src/examples/vertices.ts
new file mode 100644
index 0000000..56d7137
--- /dev/null
+++ b/src/examples/vertices.ts
@@ -0,0 +1,60 @@
+import { LayoutDefinition } from "../constraints/definition";
+
+export const vertices: LayoutDefinition = {
+ Center: {
+ constraints: [
+ {
+ component: "parent",
+ fromSide: "top",
+ toSide: "top",
+ distance: 64
+ },
+ {
+ component: "parent",
+ fromSide: "right",
+ toSide: "right",
+ distance: -64
+ },
+ {
+ component: "parent",
+ fromSide: "bottom",
+ toSide: "bottom",
+ distance: -64
+ },
+ {
+ component: "parent",
+ fromSide: "left",
+ toSide: "left",
+ distance: 64
+ }
+ ]
+ },
+ BottomLeft: {
+ constraints: [
+ {
+ component: "Center",
+ fromSide: "top",
+ toSide: "bottom",
+ distance: -32
+ },
+ {
+ component: "Center",
+ fromSide: "right",
+ toSide: "left",
+ distance: 32
+ },
+ {
+ component: "Center",
+ fromSide: "bottom",
+ toSide: "bottom",
+ distance: 32
+ },
+ {
+ component: "Center",
+ fromSide: "left",
+ toSide: "left",
+ distance: -32
+ }
+ ]
+ }
+};