Skip to content

Commit

Permalink
asas
Browse files Browse the repository at this point in the history
  • Loading branch information
flosrn committed Oct 24, 2023
1 parent 9be4ee5 commit 60bda5a
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/components/posters/zoom-image.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";

import React, { useCallback } from "react";
import { useZoomStore } from "~/store/zoomStore";
import { ErrorBoundary } from "react-error-boundary";
import { Controlled as ControlledZoom } from "react-medium-image-zoom";

import "react-medium-image-zoom/dist/styles.css";

import { useZoomStore } from "~/store/zoomStore";

type ZoomImageProps = {
imageUrl: string;
alt: string;
Expand All @@ -26,15 +26,22 @@ const ZoomImage = ({ imageUrl, alt }: ZoomImageProps) => {
);

return (
<div className="absolute left-0 top-0">
<ControlledZoom
isZoomed={isZoomOpen}
onZoomChange={handleZoomChange}
zoomMargin={30}
>
<img src={imageUrl} alt={alt} />
</ControlledZoom>
</div>
<ErrorBoundary
fallbackRender={({ resetErrorBoundary }) => {
resetErrorBoundary();
return null;
}}
>
<div className="absolute left-0 top-0">
<ControlledZoom
isZoomed={isZoomOpen}
onZoomChange={handleZoomChange}
zoomMargin={30}
>
<img src={imageUrl} alt={alt} />
</ControlledZoom>
</div>
</ErrorBoundary>
);
};

Expand Down

1 comment on commit 60bda5a

@vercel
Copy link

@vercel vercel bot commented on 60bda5a Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.