Cap NewsletterModal's width through Tablet instead of just stacking it

Stacking single-column at lg: (previous attempt) let the dialog stretch
to near-full-viewport-width at real Tablet widths, since max-w-[75rem]
barely constrains it there — the photo blew up huge and the text below
read as lost/disconnected. Caps the dialog at max-w-[36rem] through the
640-1023px band (only widening to 75rem once the lg: 2-column split
kicks in), so it reads as a compact modal at every width, not a
near-full-bleed stack.
This commit is contained in:
Marco
2026-07-29 11:35:31 +00:00
parent 5c43a49ba9
commit 724530b073
+23 -8
View File
@@ -144,7 +144,17 @@ export function NewsletterModal({ open, onClose }: { open: boolean; onClose: ()
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 16, scale: 0.97 }}
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
className="relative bg-bg-base rounded-md overflow-hidden w-full max-w-[75rem] max-h-[90vh] overflow-y-auto"
// Capped narrower than the Desktop 75rem through the whole
// 640-1023px Tablet band — this dialog is a modal, not a page
// section, so at Tablet it should read as a compact centered
// card, not stretch to near-full-viewport-width once stacked
// single-column (see the flex-col/flex-row split below):
// full-bleed-width + a single stacked photo/text column made
// the photo huge and the text below it look lost/disconnected
// (reported 2026-07-29, after first trying a lg:-gated
// structural stack with no width cap). max-w-[75rem] only
// takes over once the 2-column split itself starts at lg:.
className="relative bg-bg-base rounded-md overflow-hidden w-full max-w-[36rem] lg:max-w-[75rem] max-h-[90vh] overflow-y-auto"
>
<button
ref={closeButtonRef}
@@ -156,14 +166,17 @@ export function NewsletterModal({ open, onClose }: { open: boolean; onClose: ()
<Image alt="" src="/icon-close.png" width={24} height={24} className="size-full object-contain" />
</button>
{/* modal-top: photo + copy/form, stacked below sm (moved down from the old md:) */}
<div className="flex flex-col sm:flex-row items-stretch border-b border-border">
<div className="relative w-full sm:flex-1 aspect-[4/3] sm:aspect-auto">
{/* modal-top: photo + copy/form, stacked below lg: — paired with
the dialog's own narrower max-w-[36rem] cap through Tablet
(see above), so the stacked photo stays a reasonably-sized
4:3 banner instead of blowing up to near-full-viewport-width. */}
<div className="flex flex-col lg:flex-row items-stretch border-b border-border">
<div className="relative w-full lg:flex-1 aspect-[4/3] lg:aspect-auto">
<Image
src="/newsletter-modal-photo.jpg"
alt="Notizbuch mit Kaffee und Stift"
fill
sizes="(min-width: 640px) 50vw, 100vw"
sizes="(min-width: 1024px) 50vw, 36rem"
className="object-cover"
/>
</div>
@@ -172,8 +185,8 @@ export function NewsletterModal({ open, onClose }: { open: boolean; onClose: ()
{/* -scale-y-100 is required, not just -rotate-4 — the SVG
itself is authored upside-down (matches how Newsletter.tsx
uses this exact same asset); without it the icon renders
flipped. Hidden below sm: — removed on mobile 2026-07-24. */}
<div className="hidden sm:block w-16 h-14 -rotate-4 -scale-y-100">
flipped. Hidden below lg: — removed on mobile 2026-07-24. */}
<div className="hidden lg:block w-16 h-14 -rotate-4 -scale-y-100">
<Image alt="" src="/newsletter-icon.svg" width={64} height={56} className="w-full h-full" />
</div>
@@ -263,7 +276,9 @@ export function NewsletterModal({ open, onClose }: { open: boolean; onClose: ()
items-start + a fixed icon bounding box (icons have different
native proportions, e.g. the sparkle glyph isn't square) fixes
it without needing the flip trick. */}
<div className="flex flex-col sm:flex-row items-start px-8 md:px-20 py-6 md:py-9 gap-8 sm:gap-6">
{/* Same lg: exception as modal-top above, for the same narrower-
dialog-width-through-Tablet reason. */}
<div className="flex flex-col lg:flex-row items-start px-8 md:px-20 py-6 md:py-9 gap-8 lg:gap-6">
{features.map((f) => (
<div key={f.title} className="flex-1 flex gap-6 items-start w-full">
<div className="relative h-10 w-10 shrink-0 flex items-center justify-center">