mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
23 lines
No EOL
725 B
TypeScript
23 lines
No EOL
725 B
TypeScript
'use client';
|
|
|
|
import { useMemo } from "react";
|
|
import { VscodeFolderIcon } from "@/app/components/vscodeFolderIcon";
|
|
import { VscodeFileIcon } from "@/app/components/vscodeFileIcon";
|
|
import { FileTreeItem } from "../types";
|
|
|
|
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;
|
|
} |