diff --git a/client/components/CTAButtonGroup.tsx b/client/components/CTAButtonGroup.tsx new file mode 100644 index 00000000..6010c7e0 --- /dev/null +++ b/client/components/CTAButtonGroup.tsx @@ -0,0 +1,115 @@ +import { ReactNode } from "react"; +import { Button } from "@/components/ui/button"; +import { LucideIcon } from "lucide-react"; + +export interface CTAButton { + label: string; + icon?: LucideIcon; + onClick?: () => void; + href?: string; + variant?: "primary" | "secondary" | "outline"; + size?: "sm" | "md" | "lg"; + fullWidth?: boolean; +} + +interface CTAButtonGroupProps { + buttons: CTAButton[]; + layout?: "horizontal" | "vertical" | "grid"; + gap?: "small" | "medium" | "large"; + centered?: boolean; +} + +export function CTAButtonGroup({ + buttons, + layout = "horizontal", + gap = "medium", + centered = false, +}: CTAButtonGroupProps) { + const gapClass = + gap === "small" ? "gap-2" : gap === "large" ? "gap-4" : "gap-3"; + + let containerClass = `flex ${gapClass}`; + if (layout === "vertical") { + containerClass = `flex flex-col ${gapClass}`; + } else if (layout === "grid") { + containerClass = `grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 ${gapClass}`; + } + + if (centered) { + containerClass += " justify-center items-center"; + } + + return ( +
+ {buttons.map((btn, idx) => { + const sizeClass = + btn.size === "sm" + ? "text-sm px-3 py-1" + : btn.size === "lg" + ? "text-lg px-6 py-3" + : "px-4 py-2"; + + const variantClass = + btn.variant === "outline" + ? "border border-opacity-30 text-opacity-75 hover:bg-opacity-10" + : btn.variant === "secondary" + ? "bg-opacity-50 hover:bg-opacity-75" + : ""; + + const widthClass = btn.fullWidth ? "w-full" : ""; + + const Element = btn.href ? "a" : "button"; + + const Icon = btn.icon; + + const baseProps = { + key: idx, + className: `${sizeClass} ${variantClass} ${widthClass}`, + onClick: btn.onClick, + ...(btn.href && { href: btn.href, target: "_blank", rel: "noopener noreferrer" }), + }; + + return ( + + ); + })} +
+ ); +} + +interface CTASectionProps { + title: string; + subtitle?: string; + buttons: CTAButton[]; + children?: ReactNode; + gradient: string; + centered?: boolean; + layout?: "horizontal" | "vertical" | "grid"; +} + +export function CTASection({ + title, + subtitle, + buttons, + children, + gradient, + centered = true, + layout = "vertical", +}: CTASectionProps) { + return ( +
+

{title}

+ {subtitle &&

{subtitle}

} + {children &&
{children}
} + +
+ ); +} + +export default { + CTAButtonGroup, + CTASection, +};