From fdda2fc71469c8978b4801ec2cd8db26d7fc191e Mon Sep 17 00:00:00 2001 From: bender Date: Fri, 6 Mar 2026 21:38:29 +0000 Subject: [PATCH] Update src/components/cardStack/hooks/useCardAnimation.ts --- .../cardStack/hooks/useCardAnimation.ts | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/cardStack/hooks/useCardAnimation.ts b/src/components/cardStack/hooks/useCardAnimation.ts index ec30084..2c3b486 100644 --- a/src/components/cardStack/hooks/useCardAnimation.ts +++ b/src/components/cardStack/hooks/useCardAnimation.ts @@ -1,12 +1,31 @@ -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; export function useCardAnimation() { const [mounted, setMounted] = useState(false); const isMobile = typeof window !== "undefined" && window.innerWidth < 768; + const itemRefs = useRef<(HTMLElement | null)[]>([]); + const bottomContentRef = useRef(null); + const containerRef = useRef(null); + const perspectiveRef = useRef(null); useEffect(() => { setMounted(true); }, []); - return { mounted, isMobile }; + const setItemRef = (index: number, el: HTMLElement | null) => { + if (!itemRefs.current) { + itemRefs.current = []; + } + itemRefs.current[index] = el; + }; + + return { + mounted, + isMobile, + itemRefs, + setItemRef, + bottomContentRef, + containerRef, + perspectiveRef, + }; }