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:
jamey
2026-02-28 01:00:48 +00:00
parent 847b5f3e5e
commit 2c634177c4
6 changed files with 458 additions and 16 deletions

View File

@@ -1662,6 +1662,139 @@
font-size: 0.8125rem;
}
.image-field-actions {
display: flex;
gap: 0.375rem;
}
.image-field-remove-btn {
color: var(--t-accent);
}
.image-field-choose-btn {
width: 100%;
justify-content: center;
}
/* ── Image picker modal ─────────────────────────────────────────── */
.image-picker-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.3);
z-index: 50;
display: flex;
align-items: flex-end;
justify-content: center;
@media (min-width: 40em) {
align-items: center;
}
}
.image-picker {
background: var(--t-surface-base);
border-radius: 0.75rem 0.75rem 0 0;
width: 100%;
max-height: 80vh;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
@media (min-width: 40em) {
border-radius: 0.75rem;
max-width: 32rem;
}
}
.image-picker-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.75rem;
& h3 {
font-size: 1rem;
font-weight: 600;
}
}
.image-picker-search {
width: 100%;
margin-bottom: 0.75rem;
}
.image-picker-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.5rem;
overflow-y: auto;
@media (min-width: 40em) {
grid-template-columns: repeat(3, 1fr);
}
}
.image-picker-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.375rem;
padding: 0.375rem;
border: 1px solid var(--t-border-default);
border-radius: 0.375rem;
background: none;
cursor: pointer;
text-align: center;
color: inherit;
transition: background 100ms;
overflow: clip;
min-width: 0;
@media (hover: hover) {
&:hover {
background: var(--t-surface-sunken);
}
}
}
.image-picker-item-thumb,
.image-picker-item-svg {
width: 100%;
aspect-ratio: 1;
border-radius: 0.25rem;
background: var(--t-surface-sunken);
}
.image-picker-item-thumb {
object-fit: cover;
}
.image-picker-item-svg {
display: flex;
align-items: center;
justify-content: center;
color: var(--t-text-primary);
opacity: 0.5;
}
.image-picker-item-name {
font-size: 0.6875rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
.image-picker-empty {
grid-column: 1 / -1;
text-align: center;
padding: 1.5rem;
color: color-mix(in oklch, var(--t-text-primary) 50%, transparent);
font-size: 0.8125rem;
}
/* ═══════════════════════════════════════════════════════════════════
Media library
═══════════════════════════════════════════════════════════════════ */
@@ -1913,13 +2046,27 @@
padding-top: 0.75rem;
}
.media-detail-scrim {
display: none;
}
@media (max-width: 47.99em) {
.media-grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.media-detail-scrim {
display: block;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 39;
animation: media-scrim-fade 0.2s ease-out;
}
.media-detail {
position: fixed;
top: auto;
bottom: 0;
left: 0;
right: 0;
@@ -1927,9 +2074,32 @@
min-width: unset;
max-height: 70vh;
border-radius: 0.75rem 0.75rem 0 0;
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
z-index: 40;
animation: media-sheet-up 0.25s ease-out;
padding: 0.75rem 1rem;
gap: 0.5rem;
}
.media-detail-preview {
display: none;
}
.media-detail-meta {
font-size: 0.75rem;
gap: 0.125rem 0.5rem;
}
.media-detail-form {
gap: 0.25rem;
}
.media-detail-form .admin-fieldset {
margin-bottom: 0;
}
.media-detail-form .admin-label {
font-size: 0.75rem;
}
}
@@ -1938,4 +2108,9 @@
to { transform: translateY(0); }
}
@keyframes media-scrim-fade {
from { opacity: 0; }
to { opacity: 1; }
}
} /* @layer admin */