From fa0fc6c6b403e30c1a4d7b190cf0dbcc3cc3bffd Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 20:09:11 +0000 Subject: [PATCH] Switch to version 3: modified src/components/sections/pricing/PricingCardTwo.tsx --- .../sections/pricing/PricingCardTwo.tsx | 286 +++++++++++++++--- 1 file changed, 238 insertions(+), 48 deletions(-) diff --git a/src/components/sections/pricing/PricingCardTwo.tsx b/src/components/sections/pricing/PricingCardTwo.tsx index adc4133..adc3ef8 100644 --- a/src/components/sections/pricing/PricingCardTwo.tsx +++ b/src/components/sections/pricing/PricingCardTwo.tsx @@ -1,56 +1,246 @@ -import React from 'react'; -import { CardStack } from '@/components/cardStack/CardStack'; +"use client"; -interface PricingCardTwoProps { - plans: Array<{ +import { memo } from "react"; +import CardStack from "@/components/cardStack/CardStack"; +import PricingBadge from "@/components/shared/PricingBadge"; +import PricingFeatureList from "@/components/shared/PricingFeatureList"; +import Button from "@/components/button/Button"; +import { useTheme } from "@/providers/themeProvider/ThemeProvider"; +import { getButtonProps } from "@/lib/buttonUtils"; +import { cls, shouldUseInvertedText } from "@/lib/utils"; +import type { LucideIcon } from "lucide-react"; +import type { ButtonConfig, CardAnimationType, TitleSegment, ButtonAnimationType } from "@/components/cardStack/types"; +import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; + +type PricingPlan = { id: string; badge: string; + badgeIcon?: LucideIcon; price: string; subtitle: string; + buttons: ButtonConfig[]; features: string[]; - }>; - title: string; - description: string; - gridVariant?: string; - animationType?: string; - useInvertedBackground?: boolean; - [key: string]: any; -} - -const PricingCardTwo: React.FC = ({ - plans, - title, - description, - gridVariant = 'uniform-all-items-equal', - animationType = 'slide-up', - useInvertedBackground = false, - ...props -}) => { - const planItems = plans.map((plan) => ( -
- {plan.badge} -

{plan.price}

-

{plan.subtitle}

-
    - {plan.features.map((feature, idx) => ( -
  • {feature}
  • - ))} -
-
- )); - - return ( - - {planItems} - - ); }; -export default PricingCardTwo; \ No newline at end of file +interface PricingCardTwoProps { + plans: PricingPlan[]; + carouselMode?: "auto" | "buttons"; + uniformGridCustomHeightClasses?: string; + animationType: CardAnimationType; + title: string; + titleSegments?: TitleSegment[]; + description: string; + tag?: string; + tagIcon?: LucideIcon; + tagAnimation?: ButtonAnimationType; + buttons?: ButtonConfig[]; + buttonAnimation?: ButtonAnimationType; + textboxLayout: TextboxLayout; + useInvertedBackground: InvertedBackground; + ariaLabel?: string; + className?: string; + containerClassName?: string; + cardClassName?: string; + textBoxTitleClassName?: string; + textBoxTitleImageWrapperClassName?: string; + textBoxTitleImageClassName?: string; + textBoxDescriptionClassName?: string; + badgeClassName?: string; + priceClassName?: string; + subtitleClassName?: string; + planButtonContainerClassName?: string; + planButtonClassName?: string; + featuresClassName?: string; + featureItemClassName?: string; + gridClassName?: string; + carouselClassName?: string; + controlsClassName?: string; + textBoxClassName?: string; + textBoxTagClassName?: string; + textBoxButtonContainerClassName?: string; + textBoxButtonClassName?: string; + textBoxButtonTextClassName?: string; +} + +interface PricingCardItemProps { + plan: PricingPlan; + shouldUseLightText: boolean; + cardClassName?: string; + badgeClassName?: string; + priceClassName?: string; + subtitleClassName?: string; + planButtonContainerClassName?: string; + planButtonClassName?: string; + featuresClassName?: string; + featureItemClassName?: string; +} + +const PricingCardItem = memo(({ + plan, + shouldUseLightText, + cardClassName = "", + badgeClassName = "", + priceClassName = "", + subtitleClassName = "", + planButtonContainerClassName = "", + planButtonClassName = "", + featuresClassName = "", + featureItemClassName = "", +}: PricingCardItemProps) => { + const theme = useTheme(); + + const getButtonConfigProps = () => { + if (theme.defaultButtonVariant === "hover-bubble") { + return { bgClassName: "w-full" }; + } + if (theme.defaultButtonVariant === "icon-arrow") { + return { className: "justify-between" }; + } + return {}; + }; + + return ( +
+ + +
+
+ {plan.price} +
+ +

+ {plan.subtitle} +

+
+ + {plan.buttons && plan.buttons.length > 0 && ( +
+ {plan.buttons.slice(0, 2).map((button, index) => ( +
+ )} + +
+ + +
+ ); +}); + +PricingCardItem.displayName = "PricingCardItem"; + +const PricingCardTwo = ({ + plans, + carouselMode = "buttons", + uniformGridCustomHeightClasses, + animationType, + title, + titleSegments, + description, + tag, + tagIcon, + tagAnimation, + buttons, + buttonAnimation, + textboxLayout, + useInvertedBackground, + ariaLabel = "Pricing section", + className = "", + containerClassName = "", + cardClassName = "", + textBoxTitleClassName = "", + textBoxTitleImageWrapperClassName = "", + textBoxTitleImageClassName = "", + textBoxDescriptionClassName = "", + badgeClassName = "", + priceClassName = "", + subtitleClassName = "", + planButtonContainerClassName = "", + planButtonClassName = "", + featuresClassName = "", + featureItemClassName = "", + gridClassName = "", + carouselClassName = "", + controlsClassName = "", + textBoxClassName = "", + textBoxTagClassName = "", + textBoxButtonContainerClassName = "", + textBoxButtonClassName = "", + textBoxButtonTextClassName = "", +}: PricingCardTwoProps) => { + const theme = useTheme(); + const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); + + return ( + + {plans.map((plan, index) => ( + + ))} + + ); +}; + +PricingCardTwo.displayName = "PricingCardTwo"; + +export default PricingCardTwo;