import { useState } from "react"; import { ChevronDown, ChevronRight } from "lucide-react"; import FileIcon from "#/icons/file.svg?react"; import FolderIcon from "#/icons/folder.svg?react"; import { FileTreeNode } from "#/utils/file-tree"; import { cn } from "#/utils/utils"; interface TreeNodeProps { node: FileTreeNode; depth: number; selectedPath: string | null; onSelectFile: (path: string) => void; } export function TreeNode({ node, depth, selectedPath, onSelectFile, }: TreeNodeProps) { const [isOpen, setIsOpen] = useState(false); const indentPx = 8 + depth * 12; if (node.isDirectory) { return (
  • {isOpen && node.children.length > 0 && ( )}
  • ); } const isSelected = selectedPath === node.path; return (
  • ); }