import {
FileArchive,
FileAudio,
FileImage,
FileQuestion,
FileSpreadsheet,
FileText,
FileVideo,
type LucideProps,
} from "lucide-react";
interface FileIconProps extends LucideProps {
contentType: string;
className?: string;
}
export function FileIcon({ contentType, className, ...props }: FileIconProps) {
const commonProps = { className: className ?? "h-5 w-5", ...props };
if (contentType.startsWith("image/")) {
return ;
}
if (contentType.startsWith("audio/")) {
return ;
}
if (contentType.startsWith("video/")) {
return ;
}
if (contentType === "application/pdf") {
return ;
}
if (
contentType.startsWith("application/vnd.ms-excel") ||
contentType.startsWith(
"application/vnd.openxmlformats-officedocument.spreadsheetml",
)
) {
return ; // Could use a specific Excel icon if available/desired
}
if (
contentType.startsWith("application/msword") ||
contentType.startsWith(
"application/vnd.openxmlformats-officedocument.wordprocessingml",
)
) {
return ;
}
if (
contentType.startsWith("application/vnd.ms-powerpoint") ||
contentType.startsWith(
"application/vnd.openxmlformats-officedocument.presentationml",
)
) {
return ;
}
if (
contentType === "application/zip" ||
contentType === "application/x-rar-compressed" ||
contentType === "application/x-7z-compressed" ||
contentType === "application/gzip" ||
contentType === "application/x-tar"
) {
return ;
}
if (contentType.startsWith("text/")) {
return ;
}
return ; // Default for unknown types
}