From 38b5f30c98ef5864b406f792fb426004b0c6244c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Thu, 28 Mar 2024 16:01:59 +0800 Subject: [PATCH] fix(imageviewer): fix imageReferrerpolicy typo and do not effect header (#2815) --- src/image-viewer/ImageViewerModal.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/image-viewer/ImageViewerModal.tsx b/src/image-viewer/ImageViewerModal.tsx index ecfb6a7cce..15c8dbabdc 100644 --- a/src/image-viewer/ImageViewerModal.tsx +++ b/src/image-viewer/ImageViewerModal.tsx @@ -239,17 +239,17 @@ type ImageViewerHeaderProps = { onImgClick: (index: number, ctx: { trigger: 'current' }) => void; images: ImageInfo[]; currentIndex: number; - imageRreferrerpolicy?: TdImageViewerProps['imageReferrerpolicy']; + imageReferrerpolicy?: TdImageViewerProps['imageReferrerpolicy']; }; function OneImagePreview({ image, classPrefix, - imageRreferrerpolicy, + imageReferrerpolicy, }: { image: ImageInfo; classPrefix: string; - imageRreferrerpolicy?: TdImageViewerProps['imageReferrerpolicy']; + imageReferrerpolicy?: TdImageViewerProps['imageReferrerpolicy']; }) { const { previewUrl } = useImagePreviewUrl(image.thumbnail || image.mainImage); return ( @@ -258,14 +258,14 @@ function OneImagePreview({ error="" src={previewUrl} className={`${classPrefix}-image-viewer__header-img`} - referrerpolicy={imageRreferrerpolicy} + referrerpolicy={imageReferrerpolicy} /> ); } const ImageViewerHeader = (props: ImageViewerHeaderProps) => { const { classPrefix } = useConfig(); - const { images, currentIndex, onImgClick, imageRreferrerpolicy } = props; + const { images, currentIndex, onImgClick, imageReferrerpolicy } = props; const [isExpand, setIsExpand] = useState(true); @@ -293,7 +293,7 @@ const ImageViewerHeader = (props: ImageViewerHeaderProps) => { })} onClick={() => onImgClick(index, { trigger: 'current' })} > - + ))} @@ -473,7 +473,12 @@ export const ImageModal: React.FC = (props) => { )} {images.length > 1 && ( <> - +
{title} {`${index + 1}/${images.length}`}