Files
bd539cad-e5a1-45ab-8774-c07…/src/components/cardStack/layouts/grid/GridLayout.tsx

26 lines
627 B
TypeScript

import React, { useContext } from 'react';
import { CardStackContext } from '../../CardStackContext';
interface GridLayoutProps {
children: React.ReactNode;
className?: string;
}
export const GridLayout: React.FC<GridLayoutProps> = ({ 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 GridLayout;