CluPilotCloud/resources/views/components/ui/nav-item.blade.php

24 lines
952 B
PHP

@props([
'href' => '#',
'active' => false,
'disabled' => false,
])
@php
$base = 'flex items-center gap-3 rounded border-l-2 px-3 py-2 text-sm font-medium min-h-11';
$state = $active
? 'bg-accent-subtle text-accent-text border-accent'
: 'text-muted border-transparent hover:bg-surface-hover hover:text-body';
@endphp
@if ($disabled)
{{-- Section not built yet: render a non-interactive item, never a dead link. --}}
<span aria-disabled="true" {{ $attributes->merge(['class' => $base.' border-transparent text-faint cursor-not-allowed']) }}>
@isset($icon)<span class="shrink-0">{{ $icon }}</span>@endisset
<span>{{ $slot }}</span>
</span>
@else
<a href="{{ $href }}" @if ($active) aria-current="page" @endif {{ $attributes->merge(['class' => $base.' '.$state]) }}>
@isset($icon)<span class="shrink-0">{{ $icon }}</span>@endisset
<span>{{ $slot }}</span>
</a>
@endif