sourcebot/packages/web/src/features/fileTree/components/fileTreeItemIcon.tsx
Brendan Kellam 2b0dac4782
feat: Ask Sourcebot (#392)
Co-authored-by: msukkari <michael.sukkarieh@mail.mcgill.ca>
2025-07-23 11:25:15 -07:00

23 lines
No EOL
727 B
TypeScript

'use client';
import { FileTreeItem } from "../actions";
import { useMemo } from "react";
import { VscodeFolderIcon } from "@/app/components/vscodeFolderIcon";
import { VscodeFileIcon } from "@/app/components/vscodeFileIcon";
interface FileTreeItemIconProps {
item: FileTreeItem;
className?: string;
}
export const FileTreeItemIcon = ({ item, className }: FileTreeItemIconProps) => {
const ItemIcon = useMemo(() => {
if (item.type === 'tree') {
return <VscodeFolderIcon folderName={item.name} className={className} />
} else {
return <VscodeFileIcon fileName={item.name} className={className} />
}
}, [item.name, item.type, className]);
return ItemIcon;
}