<%# Compact icon uploader. Locals: form - the form builder field - symbol for the file field (:icon or :icon_dark) label - heading text help - small helper paragraph (optional) current_attached - the attachment to show as "current" preview current_label - text for the preview row (e.g. "Current icon") preview_extra_class - extra css for the preview img (e.g. "bg-gray-900") %>
<%= form.label field, label, class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %> <% if local_assigns[:help].present? %>

<%= help %>

<% end %> <% if current_attached&.attached? && current_attached.blob&.persisted? && current_attached.blob.key.present? %>
<%= image_tag current_attached, class: "h-12 w-12 rounded-md object-cover border border-gray-200 dark:border-gray-700 #{local_assigns[:preview_extra_class]}", alt: current_label %>

<%= current_label %>

<%= number_to_human_size(current_attached.blob.byte_size) %>

<% end %>
· drag and drop · or click and paste (⌘V)

PNG, JPG, GIF or SVG · max 2MB