'use client' import { motion } from 'framer-motion' import Link from 'next/link' import { ChevronRight, LucideIcon } from 'lucide-react' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' interface BreadcrumbItem { label: string href?: string } interface HeroAction { label: string icon?: LucideIcon onClick?: () => void href?: string variant?: 'primary' | 'secondary' className?: string } interface HeroFeature { icon: LucideIcon label: string color?: 'blue' | 'green' | 'purple' | 'orange' | 'emerald' } interface PageHeroProps { // Basic content title: string subtitle?: string description: string // Badge configuration badge?: { text: string variant?: 'default' | 'outline' className?: string } // Icon configuration icon?: { component: LucideIcon className?: string bgColor?: string } // Breadcrumb navigation breadcrumbs?: BreadcrumbItem[] // Features/highlights (small cards below description) features?: HeroFeature[] // Action buttons actions?: HeroAction[] // Styling customization backgroundGradient?: string titleGradient?: string className?: string // Content positioning alignment?: 'center' | 'left' | 'auto' // auto = smart defaults based on content maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '7xl' } const getIconColorClasses = (color: HeroFeature['color'] = 'blue') => { const colorMap = { blue: 'text-blue-500', green: 'text-green-500', purple: 'text-purple-500', orange: 'text-orange-500', emerald: 'text-emerald-500' } return colorMap[color] } const getMaxWidthClass = (maxWidth: PageHeroProps['maxWidth'] = '5xl') => { const maxWidthMap = { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-lg', xl: 'max-w-xl', '2xl': 'max-w-2xl', '3xl': 'max-w-3xl', '4xl': 'max-w-4xl', '5xl': 'max-w-5xl', '7xl': 'max-w-7xl' } return maxWidthMap[maxWidth] } export default function PageHero({ title, subtitle, description, badge, icon, breadcrumbs, features, actions, backgroundGradient = 'from-blue-600/10 to-emerald-600/10', titleGradient = 'from-blue-600 to-emerald-600', className = '', alignment = 'auto', maxWidth = '4xl' }: PageHeroProps) { const maxWidthClass = getMaxWidthClass(maxWidth) // Smart alignment logic - Modern approach (2024-2025) // Center: Marketing/brand pages, landing pages, promotional content // Left: Content-heavy pages, documentation, application interfaces const getAlignment = () => { if (alignment !== 'auto') return alignment // Auto-detect best alignment based on content const hasActions = actions && actions.length > 0 const hasFeatures = features && features.length > 0 const hasIcon = icon !== undefined const hasBadge = badge !== undefined // Marketing/promotional content -> center if (hasActions || hasFeatures || hasIcon || hasBadge) { return 'center' } // Long description -> left (better readability) if (description.length > 120) { return 'left' } // Default to center for brand/marketing pages return 'center' } const isCenter = getAlignment() === 'center' return (
{/* Background Gradient - Standardized */}
{/* Breadcrumb Navigation - Standardized positioning and styling */} {breadcrumbs && breadcrumbs.length > 0 && ( )} {/* Main Content - Standardized container and spacing */}
{/* Badge with Icon - Standardized styling */} {badge && (
{icon && (
)} {badge.text}
)} {/* Icon (only when no badge) */} {icon && !badge && (
)} {/* Title - Standardized typography scale */}

{subtitle ? ( <> {subtitle}{' '} {title} ) : title.includes(' ') ? ( <> {title.split(' ').slice(0, -1).join(' ')}{' '} {title.split(' ').slice(-1)} ) : ( {title} )}

{/* Description - Standardized typography */}

0) || (actions && actions.length > 0) ? 'mb-8' : 'mb-0' } leading-relaxed`}> {description}

{/* Features */} {features && features.length > 0 && (
0) ? 'mb-8' : 'mb-0' }`}> {features.map((feature, index) => (
{feature.label}
))}
)} {/* Action Buttons - Standardized styling */} {actions && actions.length > 0 && (
{actions.map((action, index) => { const ButtonContent = ( <> {action.icon && } {action.label} ) const buttonClass = action.variant === 'secondary' ? "border-slate-300" : "bg-blue-600 text-white hover:bg-blue-700" if (action.href) { return ( ) } return ( ) })}
)}
) }