import { NodeResizer, type NodeProps, type Node } from '@xyflow/react' import { useCanvasStore } from '@/stores/canvasStore' import type { NodeData } from '@/types' const FONT_FAMILIES: Record = { inter: 'Inter, sans-serif', mono: '"JetBrains Mono", monospace', serif: 'Georgia, serif', sans: 'system-ui, sans-serif', } export function TextNode({ id, data, selected }: NodeProps>) { const setEditingTextId = useCanvasStore((s) => s.setEditingTextId) const rc = data.custom_colors ?? {} const borderColor = rc.border ?? '#30363d' const borderStyle = rc.border_style ?? 'none' const borderWidth = rc.border_width ?? 1 const backgroundColor = rc.background ?? 'transparent' const textColor = rc.text_color ?? '#e6edf3' const textSize: number = rc.text_size ?? 14 const fontFamily = FONT_FAMILIES[rc.font ?? 'inter'] ?? FONT_FAMILIES.inter const content = data.text_content ?? data.label ?? '' return ( <>
{ e.stopPropagation() setEditingTextId(id) }} > {content}
) }