import React from "react"; import { useCardAnimation } from "./hooks/useCardAnimation"; interface CardStackProps { children: React.ReactNode; className?: string; cardsOffset?: number; scaleFactor?: number; rotationFactor?: number; animationDuration?: number; ariaLabel: string; } export const CardStack: React.FC = ({ children, className = "", cardsOffset = 10, scaleFactor = 0.08, rotationFactor = 5, animationDuration = 500, ariaLabel, }) => { const containerRef = React.useRef(null); const { transform } = useCardAnimation({ containerRef, cardsOffset, scaleFactor, rotationFactor, animationDuration, }); const childArray = React.Children.toArray(children); return (
{childArray.map((child, index) => { const depth = index; const scale = 1 - scaleFactor * depth; const yOffset = depth * cardsOffset; const rotation = depth * rotationFactor; return (
{child}
); })}
); }; export default CardStack;