diff --git a/src/components/cardStack/CardStackContext.tsx b/src/components/cardStack/CardStackContext.tsx new file mode 100644 index 0000000..95867ab --- /dev/null +++ b/src/components/cardStack/CardStackContext.tsx @@ -0,0 +1,31 @@ +import { createContext, useContext, ReactNode } from 'react'; + +export interface CardStackContextType { + isVisible: boolean; + getAnimationProps: () => { isVisible: boolean }; + itemRefs?: Record; +} + +const CardStackContext = createContext(undefined); + +export function useCardStack() { + const context = useContext(CardStackContext); + if (!context) { + return { + isVisible: false, + getAnimationProps: () => ({ isVisible: false }), + itemRefs: {} + }; + } + return context; +} + +export function CardStackProvider({ children, value }: { children: ReactNode; value: CardStackContextType }) { + return ( + + {children} + + ); +} + +export default CardStackContext;