@props(['user' => null, 'size' => 'sm'])
@php
$user = $user ?? auth()->user();
$sizes = [
'xs' => ['h-6 w-6 text-[10px]', 'ring-1 ring-white/90', ''],
'sm' => ['h-7 w-7 text-[11px]', 'ring-1 ring-white', ''],
'md' => ['h-8 w-8 text-xs', 'ring-2 ring-white', 'shadow-sm'],
'lg' => ['h-10 w-10 text-sm', 'ring-2 ring-white', 'shadow-sm'],
'xl' => ['h-14 w-14 text-lg', 'ring-2 ring-white', 'shadow-sm'],
];
[$class, $ring, $shadow] = $sizes[$size] ?? $sizes['sm'];
$initials = $user?->iniciales() ?? '?';
$avatarClass = trim("$class rounded-full object-cover $ring $shadow");
@endphp
@if($user?->fotoUrl())
merge(['class' => "$avatarClass"]) }}>
@else
merge(['class' => "$class rounded-full bg-teal-600 text-white inline-flex items-center justify-center font-semibold $ring $shadow"]) }}>
{{ $initials }}
@endif