feat(client): add base styles for edges and handles

This commit is contained in:
2025-07-07 23:41:29 +05:00
parent 91c8efe13f
commit 443293d420
3 changed files with 43 additions and 27 deletions

View File

@@ -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;

View File

@@ -1,7 +1,8 @@
import { Handle, NodeProps, Position, Node } from "@xyflow/react"; import { Handle, NodeProps, Position, Node } from "@xyflow/react";
import DEFAULT_HANDLE_STYLE from "./defaultHandleStyle";
type IfElseNodeData = { type IfElseNodeData = {
condition?: string; condition: string;
}; };
export default function IfElseNode({ data }: NodeProps<Node & IfElseNodeData>) { export default function IfElseNode({ data }: NodeProps<Node & IfElseNodeData>) {
@@ -13,74 +14,65 @@ export default function IfElseNode({ data }: NodeProps<Node & IfElseNodeData>) {
backgroundColor: "white", backgroundColor: "white",
width: "248px", width: "248px",
height: "144px", height: "144px",
fontFamily: "sans-serif",
position: "relative",
overflow: "hidden",
}}
onClick={(e) => {
e.stopPropagation();
console.log("data", data);
}} }}
> >
<div <div
style={{ style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
padding: "8px 12px", paddingLeft: "12px",
borderBottom: "1px solid #E2E2E2",
backgroundColor: "#fff",
height: "48px", height: "48px",
fontWeight: 600, fontWeight: "600px",
fontSize: 16, fontSize: "16px",
gap: 8, gap: "12px",
}} }}
> >
<img src="./icons/node/ifElse.svg" /> ЕСЛИ - ТО <img
style={{ height: "24px", width: "24px" }}
src="/icons/node/ifElse.svg"
alt="if else logo"
/>{" "}
ЕСЛИ - ТО
</div> </div>
<div style={{ height: "1px", backgroundColor: "#E2E2E2" }}></div>
<div <div
style={{ style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
paddingLeft: "12px", paddingLeft: "12px",
borderBottom: "1px solid #E2E2E2", fontSize: "14px",
fontSize: 14,
height: "48px", height: "48px",
}} }}
> >
Если {data.condition as string}, то Если {data.condition as string}, то
</div> </div>
<div style={{ height: "1px", backgroundColor: "#E2E2E2" }}></div>
<div <div
style={{ style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
paddingLeft: "12px", paddingLeft: "12px",
fontSize: 14, fontSize: "14px",
height: "48px", height: "48px",
}} }}
> >
Иначе Иначе
</div> </div>
<Handle <Handle type="target" position={Position.Top} id="input" />
type="target"
position={Position.Top}
style={{ background: "#555" }}
id="input"
/>
<Handle <Handle
type="source" type="source"
position={Position.Right} position={Position.Right}
style={{ background: "#555" }}
id="true" id="true"
style={{ ...DEFAULT_HANDLE_STYLE }}
/> />
<Handle <Handle
type="source" type="source"
position={Position.Bottom} position={Position.Bottom}
style={{ background: "#555" }}
id="false" id="false"
style={{ ...DEFAULT_HANDLE_STYLE }}
/> />
</div> </div>
); );

View File

@@ -0,0 +1,7 @@
const DEFAULT_HANDLE_STYLE = {
width: 8,
height: 8,
backgroundColor: "#BDBDBD",
};
export default DEFAULT_HANDLE_STYLE;