Skip to content

Instantly share code, notes, and snippets.

@uztbt
Created March 6, 2021 04:01
Show Gist options
  • Save uztbt/e9f5a6ffa64e2f820ac456a2fc14381b to your computer and use it in GitHub Desktop.
Save uztbt/e9f5a6ffa64e2f820ac456a2fc14381b to your computer and use it in GitHub Desktop.
import { RenderCustomNodeElementFn } from "react-d3-tree/lib/types/common";
export const LogiNode: RenderCustomNodeElementFn = ({ nodeDatum, toggleNode}) => {
const [x, y] = [0, -50];
const [width, height] = [100, 100];
return(
<g>
<rect width={width} height={height} x={x} y={y} onClick={toggleNode}>
</rect>
<text
x={x+width/2}
y={y+height/2}
dominantBaseline="middle"
textAnchor="middle"
>
{nodeDatum.name}
</text>
</g>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment