@props([ 'variant' => 'on-light', 'mark' => false, 'alt' => null, 'class' => '', ]) @php $settings = $siteSettings ?? null; $uploadedPath = is_object($settings) ? ($settings->logo_path ?? null) : null; $uploadedAlt = is_object($settings) ? ($settings->logo_alt ?? null) : null; $resolvedAlt = $alt ?? (filled($uploadedAlt) ? $uploadedAlt : null) ?? ((is_object($settings) && filled($settings->brand_name ?? null)) ? $settings->brand_name : 'Amare Assessoria'); $variant = $variant === 'on-dark' ? 'on-dark' : 'on-light'; $kind = $mark ? 'mark' : 'lockup'; $staticSrc = asset("brand/{$kind}-{$variant}.webp"); $usesUploadedLogo = filled($uploadedPath); $src = $usesUploadedLogo ? \Illuminate\Support\Facades\Storage::disk('public')->url($uploadedPath) : $staticSrc; // Reserve the box before the image arrives (SPEC §6.4). The intrinsic size // of the shipped assets is known and fixed; an uploaded logo has arbitrary // dimensions, so it gets no attributes rather than wrong ones. The CSS // classes still govern the rendered size in both cases — width/height only // give the browser the aspect ratio to reserve. // // The webp assets are encoded at 3x the largest rendered size (lockup at // h-12 = 48 px, mark at h-8 = 32 px), which is why these are 149x144 and // 191x96 rather than the 512-wide originals kept as png fallbacks. See // tests/Feature/PublicSite/BrandAssetBudgetTest.php. $intrinsic = $usesUploadedLogo ? [] : ($mark ? ['width' => 191, 'height' => 96] : ['width' => 149, 'height' => 144]); @endphp merge([ 'src' => $src, 'alt' => $resolvedAlt, 'class' => trim('brand-logo '.$class), 'decoding' => 'async', 'loading' => 'eager', ] + $intrinsic) }} />