UNPKG

440 BJavaScriptView Raw
1import React from "react";
2import showImage from "../script/previewImage";
3const WIDTH = 270;
4const HEIGHT = 150;
5
6export default function CustomImage({ src, width, height }) {
7 const onClick = () => {
8 showImage(src);
9 };
10 return (
11 <img
12 width={width || WIDTH}
13 height={height || HEIGHT}
14 style={{ objectFit: "cover", cursor: "pointer" }}
15 src={src}
16 onClick={onClick}
17 preview={true}
18 />
19 );
20}