mirror of
https://github.com/khairul169/code-share.git
synced 2025-04-29 00:59:37 +07:00
23 lines
498 B
TypeScript
23 lines
498 B
TypeScript
import { FileSchema } from "~/server/db/schema/file";
|
|
import { ComponentProps } from "react";
|
|
import { FiFile, FiFolder } from "react-icons/fi";
|
|
|
|
type FileIconProps = {
|
|
file: Pick<FileSchema, "filename" | "isDirectory">;
|
|
className?: string;
|
|
};
|
|
|
|
const FileIcon = ({ file, className }: FileIconProps) => {
|
|
const props: ComponentProps<"svg"> = {
|
|
className,
|
|
};
|
|
|
|
if (file.isDirectory) {
|
|
return <FiFolder {...props} />;
|
|
}
|
|
|
|
return <FiFile {...props} />;
|
|
};
|
|
|
|
export default FileIcon;
|