{{-- The navigation inside one area of an app — the sections of settings, of an admin — which is a single destination in the app's own navigation. `items`, a list of `['title' => …, 'url' => …]` with an optional `icon`, `active` and `badge` (an item is current when `active` is true, or when its `url` is the page's). From `medium` (600px) they are M3's secondary tabs as links, the current one underlined; on a compact window, where a row of them never fits, a button naming the current section opens a menu of all of them, the current one marked `aria-current="page"` and each with its badge. The same list is rendered for both, and CSS shows one. The page's URL is `Livewire::originalUrl()`: while a Livewire component on the page updates, the request is Livewire's update endpoint, and comparing with it left no section lit. A row too long for its column wraps onto a grid rather than scrolling: below `large` (1200px) five or six sections go 3 + 3 and seven or more go four to a row — tabs that scroll hid the last sections on a tablet. `label` names the navigation ("Sections"). Links use `wire:navigate` unless `no-wire-navigate`. --}} @props([ 'items' => [], 'label' => null, 'noWireNavigate' => false, ]) @php $label ??= __('Sections'); $page = \Livewire\Livewire::originalUrl(); $isCurrent = fn (array $item): bool => ($item['active'] ?? false) || (filled($item['url'] ?? null) && $page === url($item['url'])); $current = collect($items)->first($isCurrent) ?? ($items[0] ?? null); $layout = match (true) { count($items) < 5 => 'medium:flex', count($items) < 7 => 'medium:grid medium:grid-cols-3 large:flex', default => 'medium:grid medium:grid-cols-4 large:flex', }; @endphp