FileListItem.tsx 477 Bytes
import React, { Fragment } from "react";
import { FileItem } from "./useFileList";
import { Link } from "react-router-dom";

import { FolderFilled, FileFilled } from "@ant-design/icons";

export function FileListItem({ item }: { item: FileItem }) {
  return item.is_folder ? (
    <Fragment>
      <Link to={`/folder/${item.id}`}>
        <FolderFilled /> {item.name}
      </Link>
    </Fragment>
  ) : (
    <Fragment>
      <FileFilled /> {item.name}
    </Fragment>
  );
}