add image picker to page editor and fix thumbnail layout
Wire up image field in block settings with a modal picker that browses the media library. Fix picker thumbnails collapsing to 14px by replacing overflow:hidden with overflow:clip on grid items (hidden sets min-height:0 in grid context). Polish media library mobile sheet with scrim overlay and tighter spacing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -142,6 +142,14 @@ defmodule BerrypodWeb.PageRenderer do
|
||||
filter={@editor_picker_filter}
|
||||
event_prefix="editor_"
|
||||
/>
|
||||
|
||||
<%!-- Image picker modal --%>
|
||||
<.image_picker
|
||||
:if={@editor_image_picker_block_id}
|
||||
images={@editor_image_picker_images}
|
||||
search={@editor_image_picker_search}
|
||||
event_prefix="editor_"
|
||||
/>
|
||||
</aside>
|
||||
|
||||
<%!-- Backdrop: tapping the page dismisses the sidebar --%>
|
||||
@@ -1029,7 +1037,13 @@ defmodule BerrypodWeb.PageRenderer do
|
||||
if image.is_svg do
|
||||
"/image_cache/#{image.id}.webp"
|
||||
else
|
||||
"/image_cache/#{image.id}-800.webp"
|
||||
# Pick the largest variant that was actually generated
|
||||
width =
|
||||
image.source_width
|
||||
|> Berrypod.Images.Optimizer.applicable_widths()
|
||||
|> List.last()
|
||||
|
||||
"/image_cache/#{image.id}-#{width || 400}.webp"
|
||||
end
|
||||
|
||||
{url, image.alt || image.filename}
|
||||
|
||||
Reference in New Issue
Block a user