@props(['hero']) {{-- Render Custom HTML if enabled --}} @if($hero->use_custom_html && $hero->custom_html)
{!! $hero->custom_html !!}
@else {{-- Render builder-based hero --}} @php $isLight = $hero->theme === 'light'; // Use pre-eager-loaded elements to avoid N+1 queries $elements = $hero->relationLoaded('elements') ? $hero->elements : $hero->elements()->get(); $floatingBadges = $elements->where('type', 'floating_badge'); $featureBullets = $elements->where('type', 'feature_bullet'); $ctaButtons = $elements->where('type', 'cta_button'); $trustIndicators = $elements->where('type', 'trust_indicator'); $imageUrl = $hero->getImageUrl(); $imageFit = $hero->image_fit ?? 'cover'; $imageZoom = $hero->image_zoom ?? 100; // Dynamic color gradients based on extracted colors $hasExtractedColors = !empty($hero->extracted_color_primary); $backgroundStyle = null; $defaultGradientClass = $isLight ? 'bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-100 dark:from-zinc-900 dark:via-zinc-800 dark:to-zinc-900' : 'bg-gradient-to-br from-zinc-900 via-zinc-800 to-zinc-900 dark:from-black dark:via-zinc-900 dark:to-black'; if ($hasExtractedColors) { $colorService = app(\App\Services\ColorExtractionService::class); $lightGradient = $colorService->generateLightGradient( $hero->extracted_color_primary, $hero->extracted_color_secondary ); $darkGradient = $colorService->generateDarkGradient( $hero->extracted_color_primary, $hero->extracted_color_secondary ); // For light theme heroes, use light gradient in light mode, dark gradient in dark mode // For dark theme heroes, always use dark gradient if ($isLight) { $backgroundStyle = "--hero-light-start: {$lightGradient['start']}; --hero-light-mid: {$lightGradient['mid']}; --hero-light-end: {$lightGradient['end']}; --hero-dark-start: {$darkGradient['start']}; --hero-dark-mid: {$darkGradient['mid']}; --hero-dark-end: {$darkGradient['end']}"; } else { $backgroundStyle = "--hero-dark-start: {$darkGradient['start']}; --hero-dark-mid: {$darkGradient['mid']}; --hero-dark-end: {$darkGradient['end']}"; } } @endphp {{-- Dynamic Hero Section --}}
{{-- Subtle pattern overlay --}}
{{-- Decorative shapes --}} @if($isLight)
@else
@endif
{{-- Content Side --}}
{{-- Badge --}} @if($hero->badge_text) @if($isLight) {{ $hero->badge_text }} @else
{{ $hero->badge_text }}
@endif @endif {{-- Header --}}

{{ $hero->header }} @if($hero->header_highlight) {{ $hero->header_highlight }} @endif

{{-- Description --}} @if($hero->description)

{{ $hero->description }}

@endif {{-- Feature Bullets (Dark theme style) --}} @if(!$isLight && $featureBullets->isNotEmpty())
@foreach($featureBullets as $feature) @php $colors = $feature->color_classes; @endphp
{{ $feature->label }}
@endforeach
@endif {{-- CTA Buttons --}} @if($ctaButtons->isNotEmpty())
@foreach($ctaButtons as $button) {{ $button->label }} @endforeach
@endif {{-- Trust Indicators (Light theme style) --}} @if($isLight && $trustIndicators->isNotEmpty())
@foreach($trustIndicators as $indicator)
{{ $indicator->label }}
@endforeach
@endif
{{-- Image Side --}}
{{-- Floating Badges --}} @foreach($floatingBadges as $badge) @php $colors = $badge->color_classes; $positionClasses = match($badge->position) { 'top-left' => 'absolute -top-4 -left-4 z-20', 'top-right' => 'absolute -top-4 -right-4 z-20', 'bottom-left' => 'absolute -bottom-4 -left-4 z-20', 'bottom-right' => 'absolute -bottom-4 -right-4 z-20', default => 'absolute -top-4 left-4 z-20', }; @endphp
@if($badge->sublabel && !$isLight && is_numeric($badge->sublabel)) {{ $badge->sublabel }} @else @php // Validate icon name - must be alphabetic with optional dashes $iconName = $badge->icon && is_string($badge->icon) && preg_match('/^[a-z]+(-[a-z]+)*$/', trim($badge->icon)) ? trim($badge->icon) : 'star'; @endphp @endif
{{ $badge->sublabel }}
{{ $badge->label }}
@endforeach {{-- Product Image --}}
@php $objectFitClass = match($imageFit) { 'contain' => 'object-contain', 'fill' => 'object-fill', default => 'object-cover', }; $showContainer = $hero->show_image_container ?? true; @endphp @if($showContainer) {{-- Square container style --}}
@if($imageUrl) {{ $hero->header }} @else @endif
@else {{-- Natural image style (no container) --}} @if($imageUrl) {{ $hero->header }} @else
@endif @endif
@if($isLight) @endif @endif {{-- End custom HTML check --}}