{{-- Left-column category navigation: back-links up the tree, current category, and its children (or siblings for a leaf), collapsed after N. Тёплая панель, текущий раздел — белым (docs/design-inventory.md). --}} @php $navItems = $children->isNotEmpty() ? $children : $siblings; $currentInList = $children->isEmpty() && $siblings->isNotEmpty(); // leaf → current highlighted inside the siblings list $collapseAfter = 8; $indent = $ancestors->isNotEmpty() ? 'ml-3' : ''; @endphp
Разделы
{{-- Back-links up the tree --}} @foreach ($ancestors as $ancestor) {{ $ancestor->name }} @endforeach {{-- Current category (own header only when it has children of its own) --}} @unless ($currentInList)
{{ $category->name }}
@endunless {{-- Children (or siblings for a leaf), collapsed after N --}} @if ($navItems->isNotEmpty())
@foreach ($navItems as $i => $item) @php($isCurrent = $currentInList && $item->id === $category->id) = $collapseAfter && ! $isCurrent) x-show="expanded" x-cloak @endif class="rounded-[var(--radius-md)] px-3 py-2 text-[15px] leading-snug transition {{ $isCurrent ? 'bg-white font-bold text-[var(--color-ink)]' : 'text-[var(--color-slate)] hover:bg-white hover:text-[var(--color-ink)]' }}"> {{ $item->name }} @endforeach @if ($navItems->count() > $collapseAfter) @endif
@endif