import React from 'react';
import { Image } from 'antd';
import defaultPosition from 'src/assets/imgs/default-position.png';

interface ImageViewerProps {
  src: string;
  alt?: string;
  className?: string;
  onClick?: () => void;
  onDoubleClick?: () => void;  // 🆕 添加双击属性
}

const ImageViewer: React.FC<ImageViewerProps> = ({
  src,
  alt,
  className,
  onClick,
  onDoubleClick,  // 🆕
}) => {
  return (
    <div className={`image-viewer ${className}`}>
      <Image
        src={src}
        alt={alt}
        onClick={onClick}
        onDoubleClick={onDoubleClick}  // 🆕 传递双击事件
        preview={false}
        fallback={defaultPosition}
      />
    </div>
  );
};

export default ImageViewer;
