feat: add experimental fdp (#681)
* feat: add experimental fdp * ci: update swarm-actions to v1 * fix: fix eslint violations * refactor: decaf
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { CafeReactFsDirectory } from './CafeReactFsDirectory'
|
||||
import { CafeReactFsFile } from './CafeReactFsFile'
|
||||
import { FsItem, isVirtualDirectory, isVirtualFile } from './CafeReactType'
|
||||
|
||||
interface Props {
|
||||
path: string
|
||||
item: FsItem
|
||||
download: (path: string) => Promise<void>
|
||||
enterDirectory: (name: string) => void
|
||||
onDeleteFile: (path: string) => Promise<void>
|
||||
onDeleteDirectory: (path: string) => Promise<void>
|
||||
backgroundColor: string
|
||||
}
|
||||
|
||||
export function CafeReactFsItem({
|
||||
path,
|
||||
item,
|
||||
download,
|
||||
enterDirectory,
|
||||
onDeleteFile,
|
||||
onDeleteDirectory,
|
||||
backgroundColor,
|
||||
}: Props) {
|
||||
if (isVirtualFile(item)) {
|
||||
return (
|
||||
<CafeReactFsFile
|
||||
path={path}
|
||||
file={item}
|
||||
download={download}
|
||||
deleteFile={onDeleteFile}
|
||||
backgroundColor={backgroundColor}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
if (isVirtualDirectory(item)) {
|
||||
return (
|
||||
<CafeReactFsDirectory
|
||||
directory={item}
|
||||
enterDirectory={enterDirectory}
|
||||
deleteDirectory={onDeleteDirectory}
|
||||
backgroundColor={backgroundColor}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user