From 9e5e1c808eb1ae905c13d91b4718aa546860ff56 Mon Sep 17 00:00:00 2001 From: 1ilit Date: Tue, 19 Sep 2023 15:49:00 +0300 Subject: [PATCH] note shape --- .vscode/settings.json | 3 --- src/components/shape.jsx | 53 +++++++++++++++++++++++++++++++++++++--- src/data/data.js | 1 + 3 files changed, 50 insertions(+), 7 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 38c7634..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "java.project.explorer.showNonJavaResources": false -} \ No newline at end of file diff --git a/src/components/shape.jsx b/src/components/shape.jsx index 9714f81..7beaf68 100644 --- a/src/components/shape.jsx +++ b/src/components/shape.jsx @@ -2,7 +2,7 @@ import { React } from "react"; import { useDrag } from "react-dnd"; import { ObjectType, defaultTableTheme } from "../data/data"; -export default function Shape() { +function Table() { const [{ isDragging }, drag] = useDrag(() => ({ type: "CARD", item: { type: ObjectType.TABLE }, @@ -16,7 +16,7 @@ export default function Shape() { ref={drag} className={`${ isDragging ? "opacity-50" : "" - } bg-gray-100 cursor-move w-[150px] h-[72px]`} + } cursor-move w-[150px] h-[72px]`} > -
+
-
+
Table
@@ -60,3 +60,48 @@ export default function Shape() {
); } + +function Note() { + const [{ isDragging }, drag] = useDrag(() => ({ + type: "CARD", + item: { type: ObjectType.NOTE }, + collect: (monitor) => ({ + isDragging: !!monitor.isDragging(), + }), + })); + + return ( +
+ + + +
+ ); +} + +export default function Shape() { + return ( +
+ +
+ +
+ + ); +} diff --git a/src/data/data.js b/src/data/data.js index 5ee4370..ee518e3 100644 --- a/src/data/data.js +++ b/src/data/data.js @@ -69,6 +69,7 @@ const ObjectType = { NONE: 0, TABLE: 1, AREA: 2, + NOTE: 3, }; export {