import { RefObject } from 'react'; import { IMedia } from '../types'; interface UseAdjacentCardWidthProps { /** Ref to the container whose dimensions constrain the card width. */ containerRef: RefObject; nextPost: IMedia | null; prevPost: IMedia | null; /** * The settled card width from useMediaCardWidth (updated after the post changes * and the new image loads). Used to clear pendingCardWidth once the real width is ready. */ currentCardWidth: string; handleNextPost: () => void; handlePreviousPost: () => void; /** Maximum fraction of the container width (0–1). Defaults to 0.8, matching useMediaCardWidth. */ maxWidthRatio?: number; } interface UseAdjacentCardWidthResult { /** * Width value to apply to the card immediately on click, before the new post's image * has loaded, so the CSS resize transition starts right away instead of after load. * Clears automatically once `currentCardWidth` settles to the real value. */ pendingCardWidth: string | null; /** Wrapper: sets pendingCardWidth for the next post, then calls handleNextPost. */ handleNextWithWidth: () => void; /** Wrapper: sets pendingCardWidth for the previous post, then calls handlePreviousPost. */ handlePrevWithWidth: () => void; } /** * Pre-computes card widths for adjacent posts so the card resize animation starts * immediately when an arrow is clicked (instead of after the new image finishes loading). * * Works alongside useMediaCardWidth: that hook drives the authoritative `currentCardWidth`. * This hook only provides a `pendingCardWidth` that bridges the gap between the click * and the moment the real image loads. */ declare const useAdjacentCardWidth: ({ containerRef, nextPost, prevPost, currentCardWidth, handleNextPost, handlePreviousPost, maxWidthRatio, }: UseAdjacentCardWidthProps) => UseAdjacentCardWidthResult; export default useAdjacentCardWidth;