"use client"; import { Image, type ImageProps } from "fumadocs-core/framework"; import type { ComponentProps } from "react"; import Zoom, { type UncontrolledProps } from "react-medium-image-zoom"; import "@/components/image-zoom.css"; export type ImageZoomProps = ImageProps & { /** * Image props when zoom in */ zoomInProps?: ComponentProps<"img">; /** * Props for `react-medium-image-zoom` */ rmiz?: UncontrolledProps; }; function getImageSrc(src: ImageProps["src"]): string { if (typeof src === "string") return src; if (typeof src === "object") { // Next.js if ("default" in src) return (src as { default: { src: string } }).default.src; return src.src; } return ""; } export function ImageZoom({ zoomInProps, children, rmiz, ...props }: ImageZoomProps) { return ( {children ?? ( )} ); }