Skip to content

Commit f389301

Browse files
simonwclaude
andauthored
Make empty state clickable to add photos (#174)
* Make empty state clickable to add photos The empty state in the image-print tool now opens the file picker when clicked, providing a more intuitive way to add photos on mobile where the file input may not be immediately visible. * Center empty state in preview area Use grid spanning and flexbox to properly center the empty state both horizontally and vertically within the preview container. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b2429cd commit f389301

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

image-print.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@
179179
text-align: center;
180180
padding: 60px 20px;
181181
color: #999;
182+
cursor: pointer;
183+
transition: background 0.2s;
184+
grid-column: 1 / -1;
185+
grid-row: 1 / -1;
186+
display: flex;
187+
flex-direction: column;
188+
align-items: center;
189+
justify-content: center;
190+
}
191+
192+
.empty-state:hover {
193+
background: #f5f5f5;
182194
}
183195

184196
.empty-state svg {
@@ -367,7 +379,10 @@ <h1>Photo print layout</h1>
367379
const totalCells = cols * numRows;
368380

369381
if (photos.length === 0) {
370-
page.innerHTML = emptyState.outerHTML;
382+
const emptyClone = emptyState.cloneNode(true);
383+
emptyClone.addEventListener('click', () => fileInput.click());
384+
page.innerHTML = '';
385+
page.appendChild(emptyClone);
371386
return;
372387
}
373388

0 commit comments

Comments
 (0)