@props(['user', 'size' => 'md'])

@php
    $classes = [
        'sm' => 'h-8 w-8 text-xs',
        'md' => 'h-10 w-10 text-sm',
        'lg' => 'h-14 w-14 text-base',
        'xl' => 'h-20 w-20 text-2xl',
    ][$size] ?? 'h-10 w-10 text-sm';
@endphp

<span {{ $attributes->merge(['class' => "inline-flex {$classes} shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-100 font-bold text-accent-700 ring-1 ring-slate-200 dark:bg-slate-800 dark:text-accent-300 dark:ring-slate-700"]) }}>
    @if ($user?->foto_perfil_url)
        <img src="{{ $user->foto_perfil_url }}" alt="{{ $user->name }}" class="h-full w-full object-cover">
    @else
        {{ $user?->iniciais ?? 'U' }}
    @endif
</span>
