feat(targets): mobile-first responsive grid + card reflow

Per Marc's "mobile is co-equal with desktop" directive, every
breakpoint gets a deliberate layout — no afterthought reflow:

  • default (<640px): grid-cols-1, full-width cards, gap-4. The
    per-card Coach CTA spans full width (justify-center) so the
    touch target is generous; the source link sits beneath
    right-aligned.
  • sm (640-1023px): grid-cols-2, gap-4. Card footer reverts to
    horizontal — Coach CTA left, source link right.
  • lg (1024px+): grid-cols-3, gap-6. Three cards per row matches
    the dashboard / insights rhythm and lets the user see all six
    core targets above the fold on a 1440px viewport.

Card internals also reflow:
  • Headline row: icon + label stack with status pill below on
    mobile (sm:flex-row sm:justify-between), inline on sm+.
  • Footer row: flex-col items-stretch on mobile,
    sm:flex-row sm:items-center sm:justify-between on sm+.

New `targets-responsive.test.tsx` pins the breakpoint classes so a
future refactor can't quietly collapse the grid back to v1.4.22's
sm:grid-cols-2 only layout.

Verified by inspection (Tailwind class audit). A Playwright sweep
across 375 / 768 / 1280 / 1440 viewports is queued for the W3e
verification phase.
This commit is contained in:
Marc-André Bombeck committed 2026-05-14 12:36:21 +02:00
1 parent 9acee2bd81
commit f223b4feae
2 files changed
+151 -13

No files matched your search

+18 -13
View File
@@ -617,29 +617,34 @@ export function TargetCard({
</div>
)}
{/* Row 6: footer — Coach CTA on the left (gated), source link
on the right (when available). Margin-top:auto pins the
footer to the card bottom so the grid rows align. */}
<div className="mt-auto flex flex-wrap items-center justify-between gap-3 pt-1">
<TargetCoachButton
prefill={coachPrefill}
sources={coachSources}
onAskCoach={onAskCoach}
aiEnabled={aiEnabled}
className="-ml-2"
/>
{/* Row 6: footer. Mobile-first reflow:
- default (<640px): stack vertically; the Coach CTA
spans full width so the touch target is generous, the
source link sits beneath it right-aligned.
- sm+ (≥640px): horizontal row, Coach left + source right.
`mt-auto` pins to card bottom so grid cells align. */}
<div className="mt-auto flex flex-col items-stretch gap-2 pt-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
{aiEnabled && (
<TargetCoachButton
prefill={coachPrefill}
sources={coachSources}
onAskCoach={onAskCoach}
aiEnabled={aiEnabled}
className="w-full justify-center sm:-ml-2 sm:w-auto sm:justify-start"
/>
)}
{sourceLink ? (
<a
href={sourceLink}
target="_blank"
rel="noopener noreferrer"
className="text-muted-foreground hover:text-foreground ml-auto inline-flex items-center gap-1 text-xs"
className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1 self-end text-xs sm:ml-auto sm:self-auto"
>
<span>{target.source}</span>
<ExternalLink className="size-3" aria-hidden="true" />
</a>
) : (
<span className="text-muted-foreground ml-auto text-xs">
<span className="text-muted-foreground self-end text-xs sm:ml-auto sm:self-auto">
{target.source}
</span>
)}