memos/web/src/components/Image.tsx
Zeng1998 4246232fbe
feat: image preview enhancement (#385)
* feat: dialog content enhancement

* update

* feat: image carousel

* update

Co-authored-by: boojack <stevenlgtm@gmail.com>
2022-11-01 09:07:14 +08:00

24 lines
578 B
TypeScript

import showPreviewImageCarouselDialog from "./PreviewImageCarouselDialog";
import "../less/image.less";
interface Props {
imgUrls: string[];
index: number;
className?: string;
}
const Image: React.FC<Props> = (props: Props) => {
const { className, imgUrls, index } = props;
const handleImageClick = () => {
showPreviewImageCarouselDialog(imgUrls, index);
};
return (
<div className={"image-container " + className} onClick={handleImageClick}>
<img src={imgUrls[index]} decoding="async" loading="lazy" />
</div>
);
};
export default Image;