import clsx from "clsx";
import React from "react";
import { Resource } from "@/types/proto/api/v1/resource_service";
import { getResourceType, getResourceUrl } from "@/utils/resource";
import Icon from "./Icon";
import showPreviewImageDialog from "./PreviewImageDialog";
import SquareDiv from "./kit/SquareDiv";
interface Props {
resource: Resource;
className?: string;
strokeWidth?: number;
}
const ResourceIcon = (props: Props) => {
const { resource } = props;
const resourceType = getResourceType(resource);
const resourceUrl = getResourceUrl(resource);
const className = clsx("w-full h-auto", props.className);
const strokeWidth = props.strokeWidth;
const previewResource = () => {
window.open(resourceUrl);
};
if (resourceType === "image/*") {
return (
showPreviewImageDialog(resourceUrl)}
decoding="async"
loading="lazy"
/>