UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

16 lines 1.12 kB
import { jsx as _jsx } from "preact/jsx-runtime"; import { Fragment } from "preact"; import BaseTreeItem from "../component/BaseTreeItem"; import { useFileBrowserDir } from "../states"; import FolderIcon from "./icons/FolderIcon"; import pathMap from "./pathMap"; const FileTreeItem = ({ fileStructure, firstFolderName, folderName, myPath }) => { const fileEntries = Object.entries(fileStructure); const [fileBrowserDir, setFileBrowserDir] = useFileBrowserDir(); const children = () => fileEntries.map(([name, fileOrFolder]) => fileOrFolder instanceof File ? null : (_jsx(FileTreeItem, { fileStructure: fileOrFolder, firstFolderName: firstFolderName, folderName: name, myPath: firstFolderName + pathMap.get(fileOrFolder) }))); if (!myPath) return _jsx(Fragment, { children: children() }); return (_jsx(BaseTreeItem, { label: folderName, expanded: true, expandable: true, selected: myPath === fileBrowserDir, onClick: () => setFileBrowserDir(myPath), IconComponent: FolderIcon, children: children })); }; export default FileTreeItem; //# sourceMappingURL=FileTreeItem.js.map