@props(['document', 'size' => 40])
@php
$ext = strtolower($document->original_file_extension);
$icon = match ($ext) {
'pdf' => 'bi-file-earmark-pdf-fill text-danger',
'doc', 'docx' => 'bi-file-earmark-word-fill text-primary',
default => 'bi-file-earmark-fill text-secondary',
};
$height = (int) round($size * 1.294);
@endphp
@if($document->hasThumbnail())
merge(['class' => 'document-thumb-img rounded border flex-shrink-0']) }}
style="width: {{ $size }}px; height: {{ $height }}px; object-fit: cover; object-position: top;">
@else
merge(['class' => 'document-thumb-icon rounded border bg-body-secondary d-inline-flex align-items-center justify-content-center flex-shrink-0']) }}
style="width: {{ $size }}px; height: {{ $height }}px;">
@endif