Thumbnail to focus
A shared layoutId carries the image from its card into a focused modal. The backdrop supports the change without competing with it.
ImageModal.tsx
"use client"; import { useEffect, useState } from "react";import { AnimatePresence, LayoutGroup, animate, motion, useMotionValue, useTransform } from "framer-motion";import Image from "next/image"; type Props = { src: string; alt?: string; layoutId?: string; className?: string; expandedClassName?: string; backdropClassName?: string; animateLayout?: boolean;}; export default function ImageModal({ src, alt = '', layoutId, className = '', expandedClassName = '', backdropClassName = '', animateLayout = false }: Props) { const [open, setOpen] = useState(false);