import { useTheme } from "next-themes"; import { Image } from "@heroui/react"; import { useRef } from "react"; interface MiniPicProps { onClick?: () => void; showOverlay?: boolean; } const MiniPic = ({ onClick, showOverlay = false }: MiniPicProps) => { const { theme } = useTheme(); const isDark = theme === "dark"; const startPos = useRef<{ x: number; y: number } | null>(null); const handleStart = (x: number, y: number) => { startPos.current = { x, y }; }; const handleEnd = (x: number, y: number) => { if (!startPos.current) return; const dx = Math.abs(x - startPos.current.x); const dy = Math.abs(y - startPos.current.y); if (dx < 5 && dy < 5) { onClick?.(); } startPos.current = null; }; return (
handleStart(e.clientX, e.clientY)} onMouseUp={(e) => handleEnd(e.clientX, e.clientY)} onTouchStart={(e) => handleStart(e.touches[0].clientX, e.touches[0].clientY)} onTouchEnd={(e) => handleEnd(e.changedTouches[0].clientX, e.changedTouches[0].clientY)} > Mini Cooper {showOverlay && (
Click for 3D
)}
); }; export default MiniPic;