Skip to content

Commit 328a018

Browse files
authored
Restore published nav-item view override
1 parent 5d0eb57 commit 328a018

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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>

0 commit comments

Comments
 (0)