From da2b84ddbacf828f0b2ee1381ceecd50253b5490 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 4 Mar 2026 00:29:20 +0000 Subject: [PATCH] Switch to version 1: modified src/components/sections/metrics/MetricCardTen.tsx --- .../sections/metrics/MetricCardTen.tsx | 250 +++++++++++++++++- 1 file changed, 242 insertions(+), 8 deletions(-) diff --git a/src/components/sections/metrics/MetricCardTen.tsx b/src/components/sections/metrics/MetricCardTen.tsx index 76ce2d1..8f3e697 100644 --- a/src/components/sections/metrics/MetricCardTen.tsx +++ b/src/components/sections/metrics/MetricCardTen.tsx @@ -1,11 +1,245 @@ -import { useCardAnimation } from '@/components/cardStack/CardStack'; +"use client"; -export function MetricCardTen() { - const { animate } = useCardAnimation(); +import { memo } from "react"; +import CardStack from "@/components/cardStack/CardStack"; +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, CardAnimationType, TitleSegment, ButtonAnimationType } from "@/components/cardStack/types"; +import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; +import type { CTAButtonVariant } from "@/components/button/types"; - return ( -
- -
- ); +type Metric = { + id: string; + title: string; + subtitle: string; + category: string; + value: string; + buttons?: ButtonConfig[]; +}; + +interface MetricCardTenProps { + metrics: Metric[]; + 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; + cardTitleClassName?: string; + subtitleClassName?: string; + categoryClassName?: string; + valueClassName?: string; + footerClassName?: string; + cardButtonClassName?: string; + cardButtonTextClassName?: string; + gridClassName?: string; + carouselClassName?: string; + controlsClassName?: string; + textBoxClassName?: string; + textBoxTagClassName?: string; + textBoxButtonContainerClassName?: string; + textBoxButtonClassName?: string; + textBoxButtonTextClassName?: string; } + +interface MetricCardItemProps { + metric: Metric; + shouldUseLightText: boolean; + defaultButtonVariant: CTAButtonVariant; + cardClassName?: string; + cardTitleClassName?: string; + subtitleClassName?: string; + categoryClassName?: string; + valueClassName?: string; + footerClassName?: string; + cardButtonClassName?: string; + cardButtonTextClassName?: string; +} + +const MetricCardItem = memo(({ + metric, + shouldUseLightText, + defaultButtonVariant, + cardClassName = "", + cardTitleClassName = "", + subtitleClassName = "", + categoryClassName = "", + valueClassName = "", + footerClassName = "", + cardButtonClassName = "", + cardButtonTextClassName = "", +}: MetricCardItemProps) => { + return ( +
+
+
+

+ {metric.title} +

+

+ {metric.subtitle} +

+
+ +
+
+ + + {metric.category} + +
+ + {metric.value} + +
+
+ + {metric.buttons && metric.buttons.length > 0 && ( +
+
+ {metric.buttons.slice(0, 2).map((button, index) => ( +
+
+ )} +
+ ); +}); + +MetricCardItem.displayName = "MetricCardItem"; + +const MetricCardTen = ({ + metrics, + carouselMode = "buttons", + uniformGridCustomHeightClasses, + animationType, + title, + titleSegments, + description, + tag, + tagIcon, + tagAnimation, + buttons, + buttonAnimation, + textboxLayout, + useInvertedBackground, + ariaLabel = "Metrics section", + className = "", + containerClassName = "", + cardClassName = "", + textBoxTitleClassName = "", + textBoxTitleImageWrapperClassName = "", + textBoxTitleImageClassName = "", + textBoxDescriptionClassName = "", + cardTitleClassName = "", + subtitleClassName = "", + categoryClassName = "", + valueClassName = "", + footerClassName = "", + cardButtonClassName = "", + cardButtonTextClassName = "", + gridClassName = "", + carouselClassName = "", + controlsClassName = "", + textBoxClassName = "", + textBoxTagClassName = "", + textBoxButtonContainerClassName = "", + textBoxButtonClassName = "", + textBoxButtonTextClassName = "", +}: MetricCardTenProps) => { + const theme = useTheme(); + const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); + + return ( + + {metrics.map((metric, index) => ( + + ))} + + ); +}; + +MetricCardTen.displayName = "MetricCardTen"; + +export default MetricCardTen;