diff --git a/app/components/AddToCartButton.tsx b/app/components/AddToCartButton.tsx index 296edff..2aea62f 100644 --- a/app/components/AddToCartButton.tsx +++ b/app/components/AddToCartButton.tsx @@ -88,7 +88,9 @@ export function AddToCartButton({ : added ? "border border-success! bg-success-subtle! hover:bg-success-subtle! text-success!" : ""; - const displayLabel = currentlyOutOfStock ? "Ausverkauft" : limitReached ? "Maximale Menge im Warenkorb" : label; + // currentlyOutOfStock has no branch here — that state renders + // NotifyMeForm instead of this button entirely (see below). + const displayLabel = limitReached ? "Maximale Menge im Warenkorb" : label; return ( // Low stock is deliberately NOT surfaced here as its own text line @@ -117,47 +119,48 @@ export function AddToCartButton({ ))} )} - - {currentlyOutOfStock && 0 ? (selectedVariant ?? "") : ""} />} + + )} ); } diff --git a/app/components/AddToCartInlineButton.tsx b/app/components/AddToCartInlineButton.tsx index b7dffed..bb08b84 100644 --- a/app/components/AddToCartInlineButton.tsx +++ b/app/components/AddToCartInlineButton.tsx @@ -113,24 +113,35 @@ export function AddToCartInlineButton({ ))} )} - - {currentlyOutOfStock && 0 ? (selectedVariant ?? "") : ""} />} + + {limitReached ? "Maximale Menge im Warenkorb" : added ? "Hinzugefügt ✓" : label} + + + + )} ); } diff --git a/app/components/NotifyMeForm.tsx b/app/components/NotifyMeForm.tsx index 16b8f21..720af59 100644 --- a/app/components/NotifyMeForm.tsx +++ b/app/components/NotifyMeForm.tsx @@ -13,6 +13,15 @@ import { isValidEmail } from "../lib/email"; * same "numericId, not id" split WishlistButton already uses. */ export function NotifyMeForm({ productId, variantName = "" }: { productId: number; variantName?: string }) { + // Collapsed by default (a single button, same height/style as + // AddToCartInlineButton's own "In den Warenkorb" button) — grid card + // layouts here rely on every card in a row being stretched to equal + // height (plain CSS Grid, no explicit height), so an always-expanded + // input+button would make an out-of-stock card taller than its row + // siblings and push THEIR buttons down as the row stretches to match. + // Expanding only after a click keeps the idle-state card height + // identical to every in-stock card next to it. + const [expanded, setExpanded] = useState(false); const [email, setEmail] = useState(""); const [status, setStatus] = useState<"idle" | "submitting" | "success" | "error">("idle"); const [error, setError] = useState(""); @@ -48,12 +57,25 @@ export function NotifyMeForm({ productId, variantName = "" }: { productId: numbe return

Danke! Wir melden uns, sobald es wieder verfügbar ist.

; } + if (!expanded) { + return ( + + ); + } + return ( // Stacked, not side-by-side — narrow product cards (shop grid, related // products) don't leave enough width for input + button in one row // without either truncating the placeholder or squeezing the button.
setEmail(e.target.value)} @@ -66,7 +88,7 @@ export function NotifyMeForm({ productId, variantName = "" }: { productId: numbe disabled={status === "submitting"} className="w-full rounded-sm border border-border px-4 py-2 text-body-sm font-semibold text-text-primary hover:border-brand transition-colors disabled:opacity-60 disabled:cursor-not-allowed" > - {status === "submitting" ? "…" : "Bei Verfügbarkeit benachrichtigen"} + {status === "submitting" ? "…" : "Absenden"} {error &&

{error}

}