diff --git a/src/components/cardStack/layouts/carousels/AutoCarousel.tsx b/src/components/cardStack/layouts/carousels/AutoCarousel.tsx index 7b03090..beb11d3 100644 --- a/src/components/cardStack/layouts/carousels/AutoCarousel.tsx +++ b/src/components/cardStack/layouts/carousels/AutoCarousel.tsx @@ -1,26 +1,25 @@ -import React, { useContext } from 'react'; -import { CardStackContext } from '../../CardStackContext'; +import { ReactNode } from 'react'; +import { useCardStack } from '../../CardStackContext'; -interface AutoCarouselProps { - children: React.ReactNode; +export interface AutoCarouselProps { + children: ReactNode; className?: string; + ariaLabel?: string; } -export const AutoCarousel: React.FC = ({ children, className = '' }) => { - const context = useContext(CardStackContext); - - if (!context) { - return
{children}
; - } - - const { isVisible, getAnimationProps } = context; +export function AutoCarousel({ children, className = '', ariaLabel = 'Auto carousel' }: AutoCarouselProps) { + const { isVisible, getAnimationProps } = useCardStack(); const animationProps = getAnimationProps(); return ( -
+
{children}
); -}; +} -export default AutoCarousel; \ No newline at end of file +export default AutoCarousel;