@props([ 'entry', /** Optional Alpine to run first (e.g. closeMobile()); no event.preventDefault. */ 'prependClick' => null, ]) @php $href = 'javascript:void(0)'; if (isset($entry['route']) && !empty($entry['route']) && Route::has($entry['route'])) { $href = route($entry['route']); } elseif (isset($entry['url']) && !empty($entry['url']) && $entry['url'] !== 'javascript:void(0)' && $entry['url'] !== '#') { $href = $entry['url']; } $handlers = array_values(array_filter([$prependClick, $entry['click'] ?? null], fn ($v) => filled($v))); $clickExpr = implode('; ', $handlers); @endphp merge(['href' => $href]) }} @if ($clickExpr !== '') @if (filled($prependClick)) {{-- Mobile: close drawer then optional config handler --}} @@click="{!! e($clickExpr) !!}" @else {{-- Desktop / default: JS handler prevents navigation when used alone --}} @@click.prevent="{!! e($clickExpr) !!}" @endif @endif > {{ $slot }}