@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. --}}
@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.
--}}
@if ($showCaption)
{{-- Saved on blur by calling the owning component with the typed
value, rather than binding a property per file. --}}
@elseif ($file->caption)