From db55a712d761955ca412217eaf94de3444489325 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 19:40:42 +0000 Subject: [PATCH] Switch to version 1: modified src/components/cardStack/CardStackTextBox.tsx --- src/components/cardStack/CardStackTextBox.tsx | 99 ++++++++++++++++--- 1 file changed, 88 insertions(+), 11 deletions(-) diff --git a/src/components/cardStack/CardStackTextBox.tsx b/src/components/cardStack/CardStackTextBox.tsx index 2fd3c93..124a4c7 100644 --- a/src/components/cardStack/CardStackTextBox.tsx +++ b/src/components/cardStack/CardStackTextBox.tsx @@ -1,15 +1,92 @@ -'use client'; +"use client"; -import React from 'react'; -import { TextBoxProps } from '@/components/cardStack/types'; +import { memo, useMemo } from "react"; +import TextBox from "@/components/Textbox"; +import { cls } from "@/lib/utils"; +import type { TextBoxProps } from "./types"; -const CardStackTextBox: React.FC = ({ title, description, className = '' }) => { - return ( -
-

{title}

-

{description}

-
- ); +const CardStackTextBox = ({ + title, + titleSegments, + description, + tag, + tagIcon, + tagAnimation, + buttons, + buttonAnimation, + textboxLayout, + useInvertedBackground, + textBoxClassName = "", + titleClassName = "", + titleImageWrapperClassName = "", + titleImageClassName = "", + descriptionClassName = "", + tagClassName = "", + buttonContainerClassName = "", + buttonClassName = "", + buttonTextClassName = "", +}: TextBoxProps) => { + const styles = useMemo(() => { + if (textboxLayout === "default") { + return { + className: cls("flex flex-col gap-3 md:gap-2", textBoxClassName), + titleClassName: cls("text-6xl font-medium text-center", titleClassName), + descriptionClassName: cls("text-lg leading-tight text-center md:max-w-6/10", descriptionClassName), + tagClassName: cls("w-fit px-3 py-1 text-sm rounded-theme card text-foreground inline-flex items-center gap-2 mb-0 mx-auto", tagClassName), + buttonContainerClassName: cls("flex flex-wrap gap-4 max-md:justify-center mt-1 md:mt-3 justify-center", buttonContainerClassName), + center: true, + }; + } + + if (textboxLayout === "inline-image") { + return { + className: cls("flex flex-col gap-3 md:gap-2", textBoxClassName), + titleClassName: cls("text-4xl md:text-5xl font-medium text-center", titleClassName), + descriptionClassName: cls("text-lg leading-tight text-center", descriptionClassName), + tagClassName: cls("w-fit px-3 py-1 text-sm rounded-theme card text-foreground inline-flex items-center gap-2 mb-0 mx-auto", tagClassName), + buttonContainerClassName: cls("flex flex-wrap gap-4 max-md:justify-center mt-1 md:mt-3 justify-center", buttonContainerClassName), + center: true, + }; + } + + return { + className: textBoxClassName, + titleClassName: cls("text-6xl font-medium", titleClassName), + descriptionClassName: cls("text-lg leading-tight", descriptionClassName), + tagClassName: cls("px-3 py-1 text-sm rounded-theme card text-foreground inline-flex items-center gap-2", tagClassName), + buttonContainerClassName: cls("flex flex-wrap gap-4 max-md:justify-center", buttonContainerClassName), + center: false, + }; + }, [textboxLayout, textBoxClassName, titleClassName, descriptionClassName, tagClassName, buttonContainerClassName]); + + if (!title && !titleSegments && !description) return null; + + return ( + + ); }; -export default CardStackTextBox; +CardStackTextBox.displayName = "CardStackTextBox"; + +export default memo(CardStackTextBox);