From fa003f67dab387bbc808569e1a3a3da3aef964ad Mon Sep 17 00:00:00 2001 From: bender Date: Thu, 12 Mar 2026 04:05:00 +0000 Subject: [PATCH] Update src/components/cardStack/layouts/carousels/ArrowCarousel.tsx --- .../layouts/carousels/ArrowCarousel.tsx | 152 ++---------------- 1 file changed, 12 insertions(+), 140 deletions(-) diff --git a/src/components/cardStack/layouts/carousels/ArrowCarousel.tsx b/src/components/cardStack/layouts/carousels/ArrowCarousel.tsx index 22d2132..634db40 100644 --- a/src/components/cardStack/layouts/carousels/ArrowCarousel.tsx +++ b/src/components/cardStack/layouts/carousels/ArrowCarousel.tsx @@ -1,144 +1,16 @@ -"use client"; +import React from 'react'; -import { memo, Children, useCallback, useEffect, useState } from "react"; -import useEmblaCarousel from "embla-carousel-react"; -import { EmblaCarouselType } from "embla-carousel"; -import CardStackTextBox from "../../CardStackTextBox"; -import { cls } from "@/lib/utils"; -import { ChevronLeft, ChevronRight } from "lucide-react"; -import { ArrowCarouselProps } from "../../types"; +export interface ArrowCarouselProps { + children?: React.ReactNode; + [key: string]: any; +} -const ArrowCarousel = ({ - children, - title, - titleSegments, - description, - tag, - tagIcon, - tagAnimation, - buttons, - buttonAnimation, - textboxLayout = "default", - useInvertedBackground, - className = "", - containerClassName = "", - carouselClassName = "", - controlsClassName = "", - textBoxClassName = "", - titleClassName = "", - titleImageWrapperClassName = "", - titleImageClassName = "", - descriptionClassName = "", - tagClassName = "", - buttonContainerClassName = "", - buttonClassName = "", - buttonTextClassName = "", - ariaLabel = "Carousel section", -}: ArrowCarouselProps) => { - const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true, align: "center" }); - const [selectedIndex, setSelectedIndex] = useState(0); - - const childrenArray = Children.toArray(children); - - const onSelect = useCallback((emblaApi: EmblaCarouselType) => { - setSelectedIndex(emblaApi.selectedScrollSnap()); - }, []); - - const scrollPrev = useCallback(() => emblaApi?.scrollPrev(), [emblaApi]); - const scrollNext = useCallback(() => emblaApi?.scrollNext(), [emblaApi]); - - useEffect(() => { - if (!emblaApi) return; - - onSelect(emblaApi); - emblaApi.on("select", onSelect).on("reInit", onSelect); - - return () => { - emblaApi.off("select", onSelect).off("reInit", onSelect); - }; - }, [emblaApi, onSelect]); - - return ( -
-
-
- -
- -
-
-
- {childrenArray.map((child, index) => ( -
-
- {child} -
-
- ))} -
-
- -
- - -
-
-
-
- ); +export const ArrowCarousel: React.FC = ({ children, ...props }) => { + return ( +
+ {children} +
+ ); }; -ArrowCarousel.displayName = "ArrowCarousel"; - -export default memo(ArrowCarousel); +export default ArrowCarousel;