You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/web/src/components/PreviewImageDialog.tsx

35 lines
752 B
TypeScript

4 years ago
import { showDialog } from "./Dialog";
import "../less/preview-image-dialog.less";
interface Props extends DialogProps {
imgUrl: string;
}
const PreviewImageDialog: React.FC<Props> = ({ destroy, imgUrl }: Props) => {
const handleCloseBtnClick = () => {
destroy();
};
return (
<>
<button className="btn close-btn" onClick={handleCloseBtnClick}>
<img className="icon-img" src="/icons/close.svg" />
</button>
<div className="img-container">
<img src={imgUrl} crossOrigin="anonymous" />
4 years ago
</div>
</>
);
};
export default function showPreviewImageDialog(imgUrl: string): void {
showDialog(
{
className: "preview-image-dialog",
},
PreviewImageDialog,
{ imgUrl }
);
}