import React, { memo } from "react"; import { Label, Node, Port, NodeChildProps, NodeProps } from "reaflow"; import styled from "styled-components"; const StyledNode = styled(Node)` stroke: black; fill: ${({ theme }) => theme.BLACK_PRIMARY}; stroke-width: 1; `; const StyledTextWrapper = styled.div` position: absolute; display: flex; justify-content: center; align-items: center; font-size: 12px; width: 100%; height: 100%; `; const StyledText = styled.pre<{ width: number; height: number }>` width: ${({ width }) => width}; height: ${({ height }) => height}; color: ${({ theme }) => theme.SILVER}; `; const StyledForeignObject = styled.foreignObject<{ width: number; height: number; }>` position: "relative" !important; pointer-events: "none" !important; width: ${({ width }) => width + "px"}; height: ${({ height }) => height + "px"}; `; const baseLabelStyle = { fill: "transparent", stroke: "transparent", strokeWidth: 0, }; const basePortStyle = { fill: "black", }; const CustomNode = ({ nodeProps }) => { const { properties: data } = nodeProps; return ( } port={} {...nodeProps} > {(nodeProps: NodeChildProps) => { const { width, height } = nodeProps; return ( {data.text} ); }} ); }; export const NodeWrapper = (nodeProps: NodeProps) => { return nodeProps.properties?.data?.type ? ( ) : ( ); };