26 lines
615 B
TypeScript
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; |