From 443293d420da1d2f09ef40bc29ee5fc86e87d8f8 Mon Sep 17 00:00:00 2001 From: vsyroc Date: Mon, 7 Jul 2025 23:41:29 +0500 Subject: [PATCH] feat(client): add base styles for edges and handles --- .../src/components/edges/defaultEdgeStyle.tsx | 17 +++++++ client/src/components/nodes/IfElseNode.tsx | 46 ++++++++----------- .../components/nodes/defaultHandleStyle.ts | 7 +++ 3 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 client/src/components/edges/defaultEdgeStyle.tsx create mode 100644 client/src/components/nodes/defaultHandleStyle.ts diff --git a/client/src/components/edges/defaultEdgeStyle.tsx b/client/src/components/edges/defaultEdgeStyle.tsx new file mode 100644 index 0000000..dd03d00 --- /dev/null +++ b/client/src/components/edges/defaultEdgeStyle.tsx @@ -0,0 +1,17 @@ +import { MarkerType } from "@xyflow/react"; + +const customEdgeStyle = { + markerEnd: { + type: MarkerType.Arrow, + width: 20, + height: 20, + color: "#BDBDBD", + }, + style: { + strokeWidth: 2, + stroke: "#BDBDBD", + }, + type: "step", +}; + +export default customEdgeStyle; diff --git a/client/src/components/nodes/IfElseNode.tsx b/client/src/components/nodes/IfElseNode.tsx index 905bf4a..c907168 100644 --- a/client/src/components/nodes/IfElseNode.tsx +++ b/client/src/components/nodes/IfElseNode.tsx @@ -1,7 +1,8 @@ import { Handle, NodeProps, Position, Node } from "@xyflow/react"; +import DEFAULT_HANDLE_STYLE from "./defaultHandleStyle"; type IfElseNodeData = { - condition?: string; + condition: string; }; export default function IfElseNode({ data }: NodeProps) { @@ -13,74 +14,65 @@ export default function IfElseNode({ data }: NodeProps) { backgroundColor: "white", width: "248px", height: "144px", - fontFamily: "sans-serif", - position: "relative", - overflow: "hidden", - }} - onClick={(e) => { - e.stopPropagation(); - console.log("data", data); }} >
- ЕСЛИ - ТО + if else logo{" "} + ЕСЛИ - ТО
+
Если {data.condition as string}, то
+
Иначе
- - + ); diff --git a/client/src/components/nodes/defaultHandleStyle.ts b/client/src/components/nodes/defaultHandleStyle.ts new file mode 100644 index 0000000..0e48908 --- /dev/null +++ b/client/src/components/nodes/defaultHandleStyle.ts @@ -0,0 +1,7 @@ +const DEFAULT_HANDLE_STYLE = { + width: 8, + height: 8, + backgroundColor: "#BDBDBD", +}; + +export default DEFAULT_HANDLE_STYLE;