diff --git a/ts/components/conversation/Image.tsx b/ts/components/conversation/Image.tsx index 44ecab416..2fd207747 100644 --- a/ts/components/conversation/Image.tsx +++ b/ts/components/conversation/Image.tsx @@ -1,19 +1,19 @@ -import React, { useCallback } from 'react'; import classNames from 'classnames'; +import React, { useCallback } from 'react'; import styled from 'styled-components'; -import { Spinner } from '../basic/Spinner'; -import { AttachmentType, AttachmentTypeWithPath } from '../../types/Attachment'; -import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch'; import { useDisableDrag } from '../../hooks/useDisableDrag'; +import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch'; +import { AttachmentType, AttachmentTypeWithPath } from '../../types/Attachment'; +import { Spinner } from '../basic/Spinner'; type Props = { alt: string; attachment: AttachmentTypeWithPath | AttachmentType; url: string | undefined; // url is undefined if the message is not visible yet - height?: number; - width?: number; + height?: number | string; + width?: number | string; overlayText?: string; @@ -46,7 +46,7 @@ export const Image = (props: Props) => { attachment, closeButton, darkOverlay, - height, + height: _height, onClick, onClickClose, onError, @@ -56,7 +56,7 @@ export const Image = (props: Props) => { forceSquare, attachmentIndex, url, - width, + width: _width, } = props; const onErrorUrlFilterering = useCallback(() => { @@ -78,6 +78,9 @@ export const Image = (props: Props) => { // data will be url if loading is finished and '' if not const srcData = !loading ? urlToLoad : ''; + const width = typeof _width === 'number' ? `${_width}px` : _width; + const height = typeof _height === 'number' ? `${_height}px` : _height; + return (