Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Mar 25, 2024
1 parent cca1b17 commit d6ebb86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/utils/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ interface ImageCommonProps {
inlineStyle?: React.CSSProperties;
}

interface ImgDOMPropsWithSrc extends React.ComponentPropsWithoutRef<'img'> {
src: string;
}

/**
* Render an image that will be swapped depending on the theme.
* We don't use the `next/image` component because we need to load images from external sources,
Expand Down Expand Up @@ -271,7 +275,7 @@ async function ImagePicture(
});
}

const imgProps: React.ComponentPropsWithoutRef<'img'> & { src: string } = {
const imgProps: ImgDOMPropsWithSrc = {
alt,
style,
loading,
Expand Down
5 changes: 2 additions & 3 deletions src/components/utils/ZoomImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function ZoomImage(
// Only allow zooming when image will not actually be larger and on mobile
React.useEffect(() => {
if (isTouchDevice()) {
setZoomable(false);
return;
}

Expand Down Expand Up @@ -70,7 +69,7 @@ export function ZoomImage(
resizeObserver?.disconnect();
mediaQueryList.removeEventListener('change', onChange);
};
}, [imgRef, width, setZoomable]);
}, [imgRef, width]);

// Preload the image that will be displayed in the modal
if (zoomable) {
Expand Down Expand Up @@ -100,7 +99,7 @@ export function ZoomImage(
setActive(false);
},
);
}, [setOpened]);
}, []);

return (
<>
Expand Down

0 comments on commit d6ebb86

Please sign in to comment.