2025-06-09 19:51:35 +00:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useMemo } from "react";
|
2025-07-23 18:25:15 +00:00
|
|
|
import { VscodeFolderIcon } from "@/app/components/vscodeFolderIcon";
|
|
|
|
|
import { VscodeFileIcon } from "@/app/components/vscodeFileIcon";
|
2025-11-14 01:21:48 +00:00
|
|
|
import { FileTreeItem } from "../types";
|
2025-06-09 19:51:35 +00:00
|
|
|
|
|
|
|
|
interface FileTreeItemIconProps {
|
|
|
|
|
item: FileTreeItem;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const FileTreeItemIcon = ({ item, className }: FileTreeItemIconProps) => {
|
2025-07-23 18:25:15 +00:00
|
|
|
const ItemIcon = useMemo(() => {
|
2025-06-09 19:51:35 +00:00
|
|
|
if (item.type === 'tree') {
|
2025-07-23 18:25:15 +00:00
|
|
|
return <VscodeFolderIcon folderName={item.name} className={className} />
|
|
|
|
|
} else {
|
|
|
|
|
return <VscodeFileIcon fileName={item.name} className={className} />
|
2025-06-09 19:51:35 +00:00
|
|
|
}
|
2025-07-23 18:25:15 +00:00
|
|
|
}, [item.name, item.type, className]);
|
2025-06-09 19:51:35 +00:00
|
|
|
|
2025-07-23 18:25:15 +00:00
|
|
|
return ItemIcon;
|
2025-06-09 19:51:35 +00:00
|
|
|
}
|