diff --git a/src/components/sections/feature/FeatureCardOne.tsx b/src/components/sections/feature/FeatureCardOne.tsx index 40eeeb4..d948d13 100644 --- a/src/components/sections/feature/FeatureCardOne.tsx +++ b/src/components/sections/feature/FeatureCardOne.tsx @@ -1,51 +1,31 @@ "use client"; -import CardStack from "@/components/cardStack/CardStack"; -import MediaContent from "@/components/shared/MediaContent"; -import Button from "@/components/button/Button"; -import { cls, shouldUseInvertedText } from "@/lib/utils"; -import { getButtonProps } from "@/lib/buttonUtils"; -import { useTheme } from "@/providers/themeProvider/ThemeProvider"; -import type { LucideIcon } from "lucide-react"; -import type { ButtonConfig, GridVariant, CardAnimationTypeWith3D, TitleSegment, ButtonAnimationType } from "@/components/cardStack/types"; +import React, { useMemo } from "react"; +import CardStack from "@/components/card/CardStack"; +import TextBox from "@/components/Textbox"; +import type { CardAnimationTypeWith3D } from "@/types/animations"; +import type { GridVariant } from "@/types/grid"; -import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; - -type FeatureCard = { - title: string; - description: string; - button?: ButtonConfig; -} & ( - | { - imageSrc: string; - imageAlt?: string; - videoSrc?: never; - videoAriaLabel?: never; - } - | { - videoSrc: string; - videoAriaLabel?: string; - imageSrc?: never; - imageAlt?: never; - } - ); - -interface FeatureCardOneProps { - features: FeatureCard[]; - carouselMode?: "auto" | "buttons"; - gridVariant: GridVariant; +export interface FeatureCardOneProps { + features?: Array<{ + id: string; + title: string; + description: string; + icon?: React.ReactNode; + mediaItems?: Array<{ type: string; src: string; alt?: string }>; + }>; + gridVariant?: GridVariant; uniformGridCustomHeightClasses?: string; - animationType: CardAnimationTypeWith3D; - title: string; - titleSegments?: TitleSegment[]; - description: string; + animationType?: CardAnimationTypeWith3D; + title?: string; + titleSegments?: Array<{ type: "text"; content: string } | { type: "image"; src: string; alt?: string }>; + description?: string; tag?: string; - tagIcon?: LucideIcon; - tagAnimation?: ButtonAnimationType; - buttons?: ButtonConfig[]; - buttonAnimation?: ButtonAnimationType; - textboxLayout: TextboxLayout; - useInvertedBackground: InvertedBackground; + tagAnimation?: "none" | "opacity" | "slide-up" | "blur-reveal"; + buttons?: Array<{ text: string; onClick?: () => void; href?: string }>; + buttonAnimation?: "none" | "opacity" | "slide-up" | "blur-reveal"; + textboxLayout?: "default" | "split" | "split-actions" | "split-description" | "inline-image"; + useInvertedBackground?: boolean; ariaLabel?: string; className?: string; containerClassName?: string; @@ -57,8 +37,8 @@ interface FeatureCardOneProps { textBoxDescriptionClassName?: string; cardTitleClassName?: string; cardDescriptionClassName?: string; - cardButtonClassName?: string; - cardButtonTextClassName?: string; + cardIconClassName?: string; + cardIconWrapperClassName?: string; gridClassName?: string; carouselClassName?: string; controlsClassName?: string; @@ -69,128 +49,94 @@ interface FeatureCardOneProps { textBoxButtonTextClassName?: string; } -const FeatureCardOne = ({ - features, - carouselMode = "buttons", - gridVariant, - uniformGridCustomHeightClasses, - animationType, - title, +const FeatureCardOne: React.FC = ({ + features = [], + gridVariant = "uniform-all-items-equal", uniformGridCustomHeightClasses = "min-h-95 2xl:min-h-105", animationType = "slide-up", title, titleSegments, - description, - tag, - tagIcon, + description = "", tag, tagAnimation, buttons, buttonAnimation, - textboxLayout, - useInvertedBackground, - ariaLabel = "Feature section", - className = "", - containerClassName = "", - cardClassName = "", - mediaClassName = "", - textBoxTitleClassName = "", - textBoxTitleImageWrapperClassName = "", - textBoxTitleImageClassName = "", - textBoxDescriptionClassName = "", - cardTitleClassName = "", - cardDescriptionClassName = "", - cardButtonClassName = "", - cardButtonTextClassName = "", - gridClassName = "", - carouselClassName = "", - controlsClassName = "", - textBoxClassName = "", - textBoxTagClassName = "", - textBoxButtonContainerClassName = "", - textBoxButtonClassName = "", - textBoxButtonTextClassName = "", -}: FeatureCardOneProps) => { - const theme = useTheme(); - const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); - - const getButtonConfigProps = () => { - if (theme.defaultButtonVariant === "hover-bubble") { - return { bgClassName: "w-full" }; - } - if (theme.defaultButtonVariant === "icon-arrow") { - return { className: "justify-between" }; - } - return {}; - }; - - return ( - - {features.map((feature, index) => ( + textboxLayout = "default", useInvertedBackground = false, + ariaLabel = "Feature section", className = "", containerClassName = "", cardClassName = "", mediaClassName = "", textBoxTitleClassName = "", textBoxTitleImageWrapperClassName = "", textBoxTitleImageClassName = "", textBoxDescriptionClassName = "", cardTitleClassName = "", cardDescriptionClassName = "", cardIconClassName = "", cardIconWrapperClassName = "", gridClassName = "", carouselClassName = "", controlsClassName = "", textBoxClassName = "", textBoxTagClassName = "", textBoxButtonContainerClassName = "", textBoxButtonClassName = "", textBoxButtonTextClassName = ""}) => { + const cardItems = useMemo( + () => + features.map((feature) => (
- -
-

- {feature.title} -

-

- {feature.description} -

-
- {feature.button && ( -
- ))} -
+ )), + [features, cardClassName, cardIconWrapperClassName, cardIconClassName, cardTitleClassName, cardDescriptionClassName, mediaClassName] + ); + + return ( +
+ {title && ( +
+ +
+ )} + +
+ + {cardItems.map((item) => item)} + +
+
); }; -FeatureCardOne.displayName = "FeatureCardOne"; - -export default FeatureCardOne; +export default FeatureCardOne; \ No newline at end of file