"use client" import Image from "next/image" import { useState } from "react" import { getIconForFolder, getIconForOpenFolder } from "vscode-icons-js" import { TFolder } from "./types" import SidebarFile from "./file" export default function SidebarFolder({ data }: { data: TFolder }) { const [isOpen, setIsOpen] = useState(false) const folder = isOpen ? getIconForOpenFolder(data.name) : getIconForFolder(data.name) return ( <>
setIsOpen((prev) => !prev)} className="w-full flex items-center h-7 px-1 transition-colors hover:bg-secondary rounded-sm cursor-pointer" > Folder icon {data.name}
{isOpen ? (
{data.children.map((child) => child.type === "file" ? ( ) : ( ) )}
) : null} ) }