lbry-desktop/ui/component/zoomableImage/view.jsx
infiinte-persistence 7419fefa2d Zoomable image viewer in Markdown (posts and comments)
## Issue
4899: Ability to expand images in markdown posts for viewing
2021-01-27 10:06:31 -05:00

20 lines
479 B
JavaScript

// @flow
import React from 'react';
import * as MODALS from 'constants/modal_types';
type Props = {
openModal: (string, {}) => void,
};
function ZoomableImage(props: Props) {
const { openModal, ...imgProps } = props;
const onClick = () => {
// $FlowFixMe
openModal(MODALS.VIEW_IMAGE, { src: imgProps.src, title: imgProps.title || imgProps.alt });
};
return <img className="img__zoomable" {...imgProps} onClick={onClick} />;
}
export default ZoomableImage;