"use client"; import type { Hero as HeroType, HeroAction } from "../../node/types"; import { cn } from "../../node/utils"; import { renderLucideIcon } from "../Lucide"; import { getSocialIcon } from "../Social"; interface HeroProps { hero: HeroType; className?: string; } interface ActionButtonProps { action: HeroAction; } function isExternalLink(link: string): boolean { return /^https?:\/\//.test(link); } function renderActionButtonIcon(iconName: string | undefined, className?: string) { if (!iconName) return null; // Try Lucide icon first const lucideIcon = renderLucideIcon(iconName, className); if (lucideIcon) return lucideIcon; // Fallback to social icon const SocialIcon = getSocialIcon(iconName); if (SocialIcon) return ; return null; } function ActionButton({ action }: ActionButtonProps) { const themeClasses = { primary: "bg-primary text-primary-foreground hover:bg-primary/90", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/90", ghost: "bg-transparent text-muted-foreground border border-base-300 hover:bg-base-200", }; const isExternal = isExternalLink(action.link); return ( {renderActionButtonIcon(action.icon, "h-4 w-4")} {action.text} ); } export function Hero({ hero, className }: HeroProps) { const { tagline, headline, description, actions } = hero; return (
{tagline &&

{tagline}

}

{headline}

{description && (

{description}

)} {actions && actions.length > 0 && (
{actions.map((action, index) => ( ))}
)}
); }