From 567bd4870cc123b03d82ffe6cb5307fe3f6af905 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 20:16:30 +0000 Subject: [PATCH] Update src/components/cardStack/layouts/carousels/AutoCarousel.tsx --- .../layouts/carousels/AutoCarousel.tsx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) 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;