{{-- Blog card component — featured and compact variants (Story 5.8) --}} @props([ 'article', 'variant' => 'compact', 'locale' => app()->getLocale(), ]) @php $articleUrl = localized_route('blog.show', ['article' => $article->slug]); // Extract excerpt from first paragraph block, strip HTML, truncate 120 chars $excerpt = ''; if (!empty($article->blocks) && is_array($article->blocks)) { foreach ($article->blocks as $block) { if (($block['type'] ?? '') === 'paragraph' && !empty($block['data']['content'])) { $excerpt = \Illuminate\Support\Str::limit(strip_tags($block['data']['content']), 120); break; } } } // Resolve thumbnail: OG image or first image block $thumbnail = null; if ($article->og_image) { $thumbnail = \Illuminate\Support\Facades\Storage::disk('blog_images')->url($article->og_image); } elseif (!empty($article->blocks) && is_array($article->blocks)) { foreach ($article->blocks as $block) { if (($block['type'] ?? '') === 'image') { $imgPath = $block['data']['path'] ?? $block['data']['url'] ?? ''; if (is_array($imgPath)) { $imgPath = $imgPath[0] ?? ''; } if ($imgPath) { $thumbnail = str_starts_with($imgPath, 'http') ? $imgPath : \Illuminate\Support\Facades\Storage::disk('public')->url($imgPath); } break; } } } @endphp @if($variant === 'featured') {{-- Featured variant: large card, image beside text, full-width --}}
{{ __('blog.featured') }}
@if($thumbnail) {{ $article->meta_title ?: $article->title }} @else
@endif
@if($article->tags->isNotEmpty()) @foreach($article->tags->take(2) as $tag) {{ $tag->name }} @endforeach @endif @if($article->published_at) @endif {{ $article->read_time }} min

{{ $article->title }}

@if($excerpt)

{{ $excerpt }}

@endif {{ __('blog.read_more') }}
@else {{-- Compact variant: standard card for grid layout --}}
@if($thumbnail) {{ $article->meta_title ?: $article->title }} @else
@endif
@if($article->tags->isNotEmpty()) @foreach($article->tags->take(2) as $tag) {{ $tag->name }} @endforeach @endif @if($article->published_at) @endif {{ $article->read_time }} min

{{ $article->title }}

@if($excerpt)

{{ $excerpt }}

@endif
@endif