@props([ // An App\Models\JobAttachment. 'file', // Livewire expression for the delete button, e.g. "removeMedia(12)". 'deleteAction' => null, 'deleteConfirm' => null, 'showCaption' => false, 'captionAction' => null, // Thumbnail-sized, for the strip under a quality check rather than a gallery. 'compact' => false, ]) @php $preview = $file->previewUrl(); @endphp @if ($compact) @if ($file->kind === 'audio') {{-- A voice note is nothing to look at, so it gets a player instead of a thumbnail, and a full row because 64px of audio control is unusable. --}}
merge(['class' => 'flex w-full items-center gap-2 rounded-lg border border-slate-200 bg-white px-2 py-1.5']) }}> @if ($deleteAction) @endif
@else
merge(['class' => 'group/tile relative h-16 w-16 shrink-0 overflow-hidden rounded-lg border border-slate-200 bg-slate-50']) }}> @if ($file->kind === 'image') {{ $file->original_name }} @elseif ($file->kind === 'video') @else {{ $file->extension_label }} @endif @if ($deleteAction) @endif
@endif @else {{-- One attachment, rendered as whatever it actually is. Video and audio play in place: making someone download a 10-second clip to find out whether it is the right one is the reason media libraries get abandoned. --}}
merge(['class' => 'group/tile relative overflow-hidden rounded-xl border border-slate-200 bg-white']) }}> @if ($file->kind === 'image')
{{ $file->caption ?: $file->original_name }}
@elseif ($file->kind === 'video')
@elseif ($file->kind === 'audio')
@else {{ $file->extension_label }} @endif @if ($file->isInDrive()) {{ __('Drive') }} @endif @if ($deleteAction) @endif
@if ($showCaption) {{-- Saved on blur by calling the owning component with the typed value, rather than binding a property per file. --}} @elseif ($file->caption)

{{ $file->caption }}

@endif

{{ $file->original_name }}

{{ $file->created_at?->timezone(config('app.display_timezone'))->format('j M Y') }} @if ($file->size > 0) · {{ $file->human_size }} @endif @if ($file->driveLink()) · {{ __('Drive') }} @endif

{{ $slot }}
@endif