Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/DTNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { memo, useState } from "react";
import { Handle, NodeProps, Position } from "reactflow";


const style = {
// wordWrap: "break-word",
whiteSpace: "pre-wrap" as "pre-wrap", // This is weird, TypoScripto...
Expand All @@ -11,6 +12,7 @@ const style = {
width: 150,
fontSize: 11,
fontFamily: "Fira Code",
display: "block",
};

const DTNode = ({
Expand All @@ -20,12 +22,16 @@ const DTNode = ({
sourcePosition = Position.Bottom
}: NodeProps) => {
const [hovered, setHovered] = useState(false);
const [collapsed, setCollapsed] = useState(false);

const hoverOn = () => setHovered(true);
const hoverOff = () => setHovered(false);
const collapseOn = () => setCollapsed(collapsed ? false : true);

const borderColor = hovered ? "#987987" : "#789789";
const borderStyle = hovered ? "dotted" : "solid";
const collapseText = collapsed ? "[+]" : "[-]";

return (
<>
<Handle
Expand All @@ -38,7 +44,7 @@ const DTNode = ({
onMouseEnter={hoverOn}
onMouseLeave={hoverOff}
>
{data?.label}
{data?.label} <button onClick={() => collapseOn()} >{collapseText}</button>
</div>
<Handle
type="source"
Expand Down