@props([ 'url' => null, 'name' => 'User', 'size' => 35, 'circle' => true, 'status' => null, // 'online', 'offline', 'busy', etc. ]) @php $classes = $circle ? 'rounded-circle' : 'rounded'; $style = "width:{$size}px; height:{$size}px; object-fit:cover;"; $initial = strtoupper(substr($name, 0, 1)); // Deterministic Color Generation (Hash del nombre para que siempre sea el mismo color) $colors = ['primary', 'success', 'danger', 'warning', 'info', 'secondary', 'indigo', 'purple', 'pink', 'teal']; $hash = crc32($name); $color = $colors[abs($hash) % count($colors)]; // Status Indicator $statusColor = match($status) { 'online' => '#28a745', 'offline' => '#6c757d', 'busy' => '#dc3545', 'away' => '#ffc107', default => null }; @endphp
@if($url) {{ $name }}merge(['class' => "$classes shadow-sm border border-white", 'style' => $style]) }}> @else
merge([ 'class' => "$classes bg-$color text-white d-inline-flex align-items-center justify-content-center shadow-sm font-weight-bold border border-white", 'style' => "$style font-size: " . ($size * 0.45) . "px;" ]) }}> {{ $initial }}
@endif {{-- Indicador de Estado --}} @if($statusColor) @endif