"use client"; import { useTheme } from "next-themes"; import Image from "next/image"; import type { ImageProps } from "next/image"; import { useEffect, useState } from "react"; import Zoom, { type ControlledProps, type UncontrolledProps, } from "react-medium-image-zoom"; import { cn } from "../lib/utils"; export type ImageZoomProps = UncontrolledProps & { isZoomed?: ControlledProps["isZoomed"]; onZoomChange?: ControlledProps["onZoomChange"]; className?: string; backdropClassName?: string; "aria-hidden"?: boolean; inert?: true; }; export const ImageZoom = ({ className, backdropClassName, "aria-hidden": ariaHidden, inert, ...props }: ImageZoomProps) => (
); interface ZoomableImageProps extends ImageProps { darkSrc?: string; imageWidth: number; imageHeight: number; } export function ZoomableImage({ src, alt, className, darkSrc, imageWidth, imageHeight, ...rest }: ZoomableImageProps) { const { resolvedTheme } = useTheme(); const [mounted, setMounted] = useState(false); const isDark = resolvedTheme === "dark"; useEffect(() => { setMounted(true); }, []); return (
{alt {alt {alt &&
{alt}
}
); }