feat(client): add react-flow css and base if else node
This commit is contained in:
87
client/src/components/nodes/IfElseNode.tsx
Normal file
87
client/src/components/nodes/IfElseNode.tsx
Normal file
@@ -0,0 +1,87 @@
|
||||
import { Handle, NodeProps, Position, Node } from "@xyflow/react";
|
||||
|
||||
type IfElseNodeData = {
|
||||
condition?: string;
|
||||
};
|
||||
|
||||
export default function IfElseNode({ data }: NodeProps<Node & IfElseNodeData>) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
border: "0px solid",
|
||||
borderRadius: 8,
|
||||
backgroundColor: "white",
|
||||
width: "248px",
|
||||
height: "144px",
|
||||
fontFamily: "sans-serif",
|
||||
position: "relative",
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
console.log("data", data);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
padding: "8px 12px",
|
||||
borderBottom: "1px solid #E2E2E2",
|
||||
backgroundColor: "#fff",
|
||||
height: "48px",
|
||||
fontWeight: 600,
|
||||
fontSize: 16,
|
||||
gap: 8,
|
||||
}}
|
||||
>
|
||||
<img src="./icons/node/ifElse.svg" /> ЕСЛИ - ТО
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
paddingLeft: "12px",
|
||||
borderBottom: "1px solid #E2E2E2",
|
||||
fontSize: 14,
|
||||
height: "48px",
|
||||
}}
|
||||
>
|
||||
Если {data.condition as string}, то
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
paddingLeft: "12px",
|
||||
fontSize: 14,
|
||||
height: "48px",
|
||||
}}
|
||||
>
|
||||
Иначе
|
||||
</div>
|
||||
|
||||
<Handle
|
||||
type="target"
|
||||
position={Position.Top}
|
||||
style={{ background: "#555" }}
|
||||
id="input"
|
||||
/>
|
||||
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Right}
|
||||
style={{ background: "#555" }}
|
||||
id="true"
|
||||
/>
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Bottom}
|
||||
style={{ background: "#555" }}
|
||||
id="false"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user