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