"use client"; import { useMemo } from "react"; import Image from "next/image"; import TextAnimation from "./text/TextAnimation"; import Button from "./button/Button"; import Tag from "./shared/Tag"; import AvatarGroup from "./shared/AvatarGroup"; import { cls } from "@/lib/utils"; import { getButtonProps } from "@/lib/buttonUtils"; import { LucideIcon } from "lucide-react"; import type { AnimationType } from "./text/types"; import { useTheme } from "@/providers/themeProvider/ThemeProvider"; import type { ButtonConfig, ButtonAnimationType } from "@/types/button"; import type { Avatar } from "./shared/AvatarGroup"; import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; import { useButtonAnimation } from "./hooks/useButtonAnimation"; type TitleSegment = | { type: "text"; content: string } | { type: "image"; src: string; alt?: string }; interface TextBoxProps { title: string; titleSegments?: TitleSegment[]; description: string; type?: AnimationType; textboxLayout?: TextboxLayout; useInvertedBackground?: InvertedBackground; className?: string; titleClassName?: string; titleImageWrapperClassName?: string; titleImageClassName?: string; descriptionClassName?: string; duration?: number; start?: string; end?: string; gradientColors?: { from: string; to: string; }; children?: React.ReactNode; center?: boolean; tag?: string; tagIcon?: LucideIcon; tagClassName?: string; tagAnimation?: ButtonAnimationType; buttons?: ButtonConfig[]; buttonAnimation?: ButtonAnimationType; buttonContainerClassName?: string; buttonClassName?: string; buttonTextClassName?: string; avatars?: Avatar[]; avatarText?: string; avatarGroupClassName?: string; avatarsAbove?: boolean; } const TextBox = ({ title, titleSegments, description, type, textboxLayout = "default", useInvertedBackground, className = "", titleClassName = "", titleImageWrapperClassName = "", titleImageClassName = "", descriptionClassName = "", duration = 1, start = "top 80%", end = "top 20%", gradientColors, children, center = false, tag, tagIcon: TagIcon, tagClassName = "", tagAnimation = "none", buttons, buttonAnimation = "none", buttonContainerClassName = "", buttonClassName = "", buttonTextClassName = "", avatars, avatarText, avatarGroupClassName = "", avatarsAbove = false, }: TextBoxProps) => { const theme = useTheme(); const { containerRef: tagContainerRef } = useButtonAnimation({ animationType: tagAnimation }); const { containerRef: buttonContainerRef } = useButtonAnimation({ animationType: buttonAnimation }); // Shared tag component const tagElement = tag ? (