{{--
Breadcrumb Component
--------------------
Responsive breadcrumb navigation with proper ARIA semantics.
Usage:
Props:
items - Array of ['label' => string, 'url' => string (optional)]
The last item is treated as the current page (rendered bold, no link).
Accessibility:
- with aria-label="Breadcrumb"
- with schema.org BreadcrumbList structured data
- aria-current="page" on the last item
- Chevron separators are aria-hidden
Responsive:
- On mobile (< 640px), middle items collapse to "..." when there are 4+ items
- First, second-to-last, and last items always visible
--}}
@props([
'items' => [],
])
@if(count($items) > 0)
@foreach($items as $i => $item)
@php
$isLast = $loop->last;
$isFirst = $loop->first;
$total = count($items);
// On mobile, collapse middle items when 4+ items exist
// Show: first, second-to-last, last. Hide everything between.
$isCollapsible = $total >= 4 && !$isFirst && !$isLast && $i !== ($total - 2);
$position = $i + 1;
@endphp
{{-- Collapsed ellipsis (shown once before the second-to-last item on mobile) --}}
@if($total >= 4 && $i === 1)
...
@endif
@if(!$isFirst)
@endif
@if($isLast)
{{ $item['label'] }}
@else
{{ $item['label'] }}
@endif
@endforeach
@endif