Files
bd539cad-e5a1-45ab-8774-c07…/src/components/cardStack/CardList.tsx

26 lines
615 B
TypeScript

import React, { useContext } from 'react';
import { CardStackContext } from './CardStackContext';
interface CardListProps {
children: React.ReactNode;
className?: string;
}
export const CardList: React.FC<CardListProps> = ({ children, className = '' }) => {
const context = useContext(CardStackContext);
if (!context) {
return <div className={className}>{children}</div>;
}
const { isVisible, getAnimationProps } = context;
const animationProps = getAnimationProps();
return (
<div className={className} {...animationProps}>
{children}
</div>
);
};
export default CardList;