@props([ 'src' => null, 'name' => null, 'size' => 'md', 'shape' => 'xl', 'status' => null, ]) @php $sizes = [ 'xs' => ['box' => 'w-7 h-7', 'text' => 'text-[10px]', 'dot' => 'w-2 h-2'], 'sm' => ['box' => 'w-9 h-9', 'text' => 'text-xs', 'dot' => 'w-2.5 h-2.5'], 'md' => ['box' => 'w-11 h-11', 'text' => 'text-sm', 'dot' => 'w-3 h-3'], 'lg' => ['box' => 'w-14 h-14', 'text' => 'text-base', 'dot' => 'w-4 h-4'], 'xl' => ['box' => 'w-20 h-20', 'text' => 'text-xl', 'dot' => 'w-5 h-5'], ]; $statusColors = [ 'online' => 'bg-emerald-500', 'busy' => 'bg-rose-500', 'offline' => 'bg-gray-400', 'away' => 'bg-amber-500', ]; $avatarSize = $sizes[$size] ?? $sizes['md']; $initials = ''; if ($name) { $words = explode(' ', $name); $initials = count($words) > 1 ? strtoupper(substr($words[0], 0, 1) . substr($words[1], 0, 1)) : strtoupper(substr($words[0], 0, 2)); } @endphp
merge(['class' => 'relative inline-flex shrink-0']) }}> {{-- Avatar Box --}}
@if($src) {{ $name }} @elseif($name) {{ $initials }} @else @endif
@if($status) @endif