Skip to content

Commit 9ed32b4

Browse files
authored
Merge pull request #9 from u8array/feature/labelary-preview-ui
feat(labelary-preview): inset background and overflow scrolling for o…
2 parents 66ceb5c + 3b090c7 commit 9ed32b4

1 file changed

Lines changed: 31 additions & 29 deletions

File tree

‎src/components/Output/LabelPreview.tsx‎

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export function LabelPreviewModal({ onClose }: Props) {
5151
onClick={onClose}
5252
>
5353
<div
54-
className="bg-surface border border-border rounded shadow-lg flex flex-col overflow-hidden max-w-[90vw] max-h-[90vh]"
54+
className="bg-surface border border-border-2 rounded shadow-lg flex flex-col overflow-hidden max-w-[90vw] max-h-[90vh]"
5555
onClick={(e) => e.stopPropagation()}
5656
>
57-
<div className="flex items-center justify-between px-3 py-1.5 border-b border-border shrink-0">
57+
<div className="flex items-center justify-between px-3 py-1.5 border-b border-border-2 shrink-0">
5858
<span className="font-mono text-[10px] text-muted uppercase tracking-widest">
5959
{t.output.previewHeading}
6060
</span>
@@ -66,33 +66,35 @@ export function LabelPreviewModal({ onClose }: Props) {
6666
</button>
6767
</div>
6868

69-
<div className="flex-1 flex items-center justify-center p-4 min-h-24 min-w-48">
70-
{loading && (
71-
<span className="font-mono text-[10px] text-muted animate-pulse">{t.output.loading}</span>
72-
)}
73-
{!loading && error && (
74-
<div className="flex flex-col items-center gap-3 max-w-64 text-center">
75-
<span className="font-mono text-[10px] text-amber-400 leading-relaxed">{error}</span>
76-
<button
77-
onClick={handleDownloadFallback}
78-
className="flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-mono bg-surface-2 border border-border text-muted hover:text-text hover:border-accent transition-colors"
79-
>
80-
<ArrowDownTrayIcon className="w-3.5 h-3.5" />
81-
Export ZPL instead
82-
</button>
83-
</div>
84-
)}
85-
{!loading && !error && previewUrl && (
86-
<img
87-
src={previewUrl}
88-
alt="Label preview"
89-
style={{
90-
maxWidth: '100%',
91-
maxHeight: '100%',
92-
display: 'block',
93-
}}
94-
/>
95-
)}
69+
{/* Inset preview area: bg-bg gives a clear edge against the surrounding
70+
surface (especially in light mode where the label image is white).
71+
The outer div scrolls; the inner one stays at least as large as the
72+
viewport so small previews are still centered. */}
73+
<div className="flex-1 overflow-auto bg-bg min-h-24 min-w-48">
74+
<div className="min-h-full min-w-full flex items-center justify-center p-4">
75+
{loading && (
76+
<span className="font-mono text-[10px] text-muted animate-pulse">{t.output.loading}</span>
77+
)}
78+
{!loading && error && (
79+
<div className="flex flex-col items-center gap-3 max-w-64 text-center">
80+
<span className="font-mono text-[10px] text-amber-400 leading-relaxed">{error}</span>
81+
<button
82+
onClick={handleDownloadFallback}
83+
className="flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-mono bg-surface-2 border border-border text-muted hover:text-text hover:border-accent transition-colors"
84+
>
85+
<ArrowDownTrayIcon className="w-3.5 h-3.5" />
86+
Export ZPL instead
87+
</button>
88+
</div>
89+
)}
90+
{!loading && !error && previewUrl && (
91+
<img
92+
src={previewUrl}
93+
alt="Label preview"
94+
className="block shrink-0"
95+
/>
96+
)}
97+
</div>
9698
</div>
9799
</div>
98100
</div>

0 commit comments

Comments
 (0)