From 3cf272f29f1237931024e82cb604d7f0a94d5120 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 20:09:08 +0000 Subject: [PATCH] Switch to version 3: modified src/components/sections/metrics/MetricCardOne.tsx --- .../sections/metrics/MetricCardOne.tsx | 248 +++++++++++++++--- 1 file changed, 206 insertions(+), 42 deletions(-) diff --git a/src/components/sections/metrics/MetricCardOne.tsx b/src/components/sections/metrics/MetricCardOne.tsx index 50d2b0d..b8daa06 100644 --- a/src/components/sections/metrics/MetricCardOne.tsx +++ b/src/components/sections/metrics/MetricCardOne.tsx @@ -1,48 +1,212 @@ -import React from 'react'; -import { CardStack } from '@/components/cardStack/CardStack'; +"use client"; -interface MetricCardOneProps { - metrics: Array<{ +import { memo } from "react"; +import CardStack from "@/components/cardStack/CardStack"; +import { cls, shouldUseInvertedText } from "@/lib/utils"; +import { useTheme } from "@/providers/themeProvider/ThemeProvider"; +import type { LucideIcon } from "lucide-react"; +import type { ButtonConfig, GridVariant, CardAnimationTypeWith3D, TitleSegment, ButtonAnimationType } from "@/components/cardStack/types"; +import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; + +type MetricCardOneGridVariant = Extract; + +type Metric = { id: string; value: string; + title: string; description: string; - }>; - title: string; - description: string; - gridVariant?: string; - animationType?: string; - useInvertedBackground?: boolean; - [key: string]: any; -} - -const MetricCardOne: React.FC = ({ - metrics, - title, - description, - gridVariant = 'uniform-all-items-equal', - animationType = 'slide-up', - useInvertedBackground = false, - ...props -}) => { - const metricItems = metrics.map((metric) => ( -
-

{metric.value}

-

{metric.description}

-
- )); - - return ( - - {metricItems} - - ); + icon: LucideIcon; }; -export default MetricCardOne; \ No newline at end of file +interface MetricCardOneProps { + metrics: Metric[]; + carouselMode?: "auto" | "buttons"; + gridVariant: MetricCardOneGridVariant; + uniformGridCustomHeightClasses?: string; + animationType: CardAnimationTypeWith3D; + 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; + valueClassName?: string; + titleClassName?: string; + descriptionClassName?: string; + iconContainerClassName?: string; + iconClassName?: string; + gridClassName?: string; + carouselClassName?: string; + controlsClassName?: string; + textBoxClassName?: string; + textBoxTagClassName?: string; + textBoxButtonContainerClassName?: string; + textBoxButtonClassName?: string; + textBoxButtonTextClassName?: string; +} + +interface MetricCardItemProps { + metric: Metric; + shouldUseLightText: boolean; + cardClassName?: string; + valueClassName?: string; + titleClassName?: string; + descriptionClassName?: string; + iconContainerClassName?: string; + iconClassName?: string; +} + +const MetricCardItem = memo(({ + metric, + shouldUseLightText, + cardClassName = "", + valueClassName = "", + titleClassName = "", + descriptionClassName = "", + iconContainerClassName = "", + iconClassName = "", +}: MetricCardItemProps) => { + return ( +
+

+ {metric.value} +

+

+ {metric.title} +

+

+ {metric.description} +

+
+ +
+
+ ); +}); + +MetricCardItem.displayName = "MetricCardItem"; + +const MetricCardOne = ({ + metrics, + carouselMode = "buttons", + gridVariant, + uniformGridCustomHeightClasses, + animationType, + title, + titleSegments, + description, + tag, + tagIcon, + tagAnimation, + buttons, + buttonAnimation, + textboxLayout, + useInvertedBackground, + ariaLabel = "Metrics section", + className = "", + containerClassName = "", + cardClassName = "", + textBoxTitleClassName = "", + textBoxTitleImageWrapperClassName = "", + textBoxTitleImageClassName = "", + textBoxDescriptionClassName = "", + valueClassName = "", + titleClassName = "", + descriptionClassName = "", + iconContainerClassName = "", + iconClassName = "", + gridClassName = "", + carouselClassName = "", + controlsClassName = "", + textBoxClassName = "", + textBoxTagClassName = "", + textBoxButtonContainerClassName = "", + textBoxButtonClassName = "", + textBoxButtonTextClassName = "", +}: MetricCardOneProps) => { + const theme = useTheme(); + const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); + + const customUniformHeight = gridVariant === "uniform-all-items-equal" + ? "min-h-70 2xl:min-h-80" + : uniformGridCustomHeightClasses; + + return ( + + {metrics.map((metric, index) => ( + + ))} + + ); +}; + +MetricCardOne.displayName = "MetricCardOne"; + +export default MetricCardOne;