File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {{-- Menu Module: Navigation Item Component --}}
2+ {{-- Override active-state styling for frontend menu items --}}
3+
4+ @props ([
5+ " href" => route (" home" ),
6+ " title" ,
7+ " active" => " " ,
8+ " target" => " _self" ,
9+ ] )
10+
11+ <?php
12+ $activeClasses = " border-transparent dark:border-transparent" ;
13+
14+ if ($active ) {
15+ $activeClasses = " border-gray-700 text-gray-900 dark:border-gray-300 dark:text-white" ;
16+ }
17+
18+ // Add wire:navigate for internal links only (not external or new tab)
19+ $shouldNavigate = $target === ' _self' ;
20+ ? >
21+
22+ <li >
23+ <a
24+ class =" {{ $activeClasses } } block border-b-2 px-3 py-2 text-gray-800 transition duration-200 ease-in hover:border-gray-700 hover:opacity-75 dark:text-white dark:hover:border-gray-300 dark:hover:opacity-75 sm:my-0 sm:py-1"
25+ href =" {{ $href } }"
26+ target =" {{ $target } }"
27+ @if ($shouldNavigate ) wire:navigate @endif
28+ @if ($target === ' _blank' ) aria-label =" {{ $slot } } (opens in new tab)" @endif
29+ >
30+ {{ $slot } }
31+ @if ($target === ' _blank' )
32+ <span class =" sr-only" >(opens in new tab)</span >
33+ @endif
34+ </a >
35+ </li >
You can’t perform that action at this time.
0 commit comments