diff --git a/src/components/cardStack/CardList.tsx b/src/components/cardStack/CardList.tsx index c6df9b8..15a4d59 100644 --- a/src/components/cardStack/CardList.tsx +++ b/src/components/cardStack/CardList.tsx @@ -1,27 +1,123 @@ -import React from "react"; -import { useCardAnimation } from "./hooks/useCardAnimation"; +"use client"; + +import { memo, Children } from "react"; +import CardStackTextBox from "@/components/cardStack/CardStackTextBox"; +import { useCardAnimation } from "@/components/cardStack/hooks/useCardAnimation"; +import { cls } from "@/lib/utils"; +import type { LucideIcon } from "lucide-react"; +import type { ButtonConfig, ButtonAnimationType, CardAnimationType, TitleSegment } from "@/components/cardStack/types"; +import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; interface CardListProps { - items: any[]; + children: React.ReactNode; + animationType: CardAnimationType; + useUncappedRounding?: boolean; + title?: string; + titleSegments?: TitleSegment[]; + description?: string; + tag?: string; + tagIcon?: LucideIcon; + tagAnimation?: ButtonAnimationType; + buttons?: ButtonConfig[]; + buttonAnimation?: ButtonAnimationType; + textboxLayout: TextboxLayout; + useInvertedBackground?: InvertedBackground; + disableCardWrapper?: boolean; + ariaLabel?: string; className?: string; + containerClassName?: string; + cardClassName?: string; + textBoxClassName?: string; + titleClassName?: string; + titleImageWrapperClassName?: string; + titleImageClassName?: string; + descriptionClassName?: string; + tagClassName?: string; + buttonContainerClassName?: string; + buttonClassName?: string; + buttonTextClassName?: string; } -export default function CardList({ items, className = "" }: CardListProps) { - const state = useCardAnimation({ - rotationX: 0, - rotationY: 0, - rotationZ: 0, - perspective: 1000, - duration: 0.3, - }); +const CardList = ({ + children, + animationType, + useUncappedRounding = false, + title, + titleSegments, + description, + tag, + tagIcon, + tagAnimation, + buttons, + buttonAnimation, + textboxLayout, + useInvertedBackground, + disableCardWrapper = false, + ariaLabel = "Card list", + className = "", + containerClassName = "", + cardClassName = "", + textBoxClassName = "", + titleClassName = "", + titleImageWrapperClassName = "", + titleImageClassName = "", + descriptionClassName = "", + tagClassName = "", + buttonContainerClassName = "", + buttonClassName = "", + buttonTextClassName = "", +}: CardListProps) => { + const childrenArray = Children.toArray(children); + const { itemRefs } = useCardAnimation({ animationType, itemCount: childrenArray.length, useIndividualTriggers: true }); return ( -