Skip to content

fix(gift-cards): follow standard header pattern across all routes#1074

Draft
gudnuf wants to merge 2 commits into
masterfrom
fix/page-header-x-shift
Draft

fix(gift-cards): follow standard header pattern across all routes#1074
gudnuf wants to merge 2 commits into
masterfrom
fix/page-header-x-shift

Conversation

@gudnuf
Copy link
Copy Markdown
Contributor

@gudnuf gudnuf commented May 14, 2026

Summary

Every other page in the app uses the same header pattern:

```tsx

<ClosePageButton to="..." transition="..." applyTo="..." />
Title

```

That pattern works because:

  • The title's `text-xl` line-height makes the grid row 28px tall
  • `ClosePageButton` renders an anchor that collapses around its block svg child to exactly 24px (inline-around-block per CSS spec)
  • The in-flow header inherits `Page`'s horizontal padding consistently on every breakpoint

The gift card detail/offer/add pages deviated in three ways:

  1. Absolute positioning (`absolute inset-x-0 top-0`) — escapes `Page`'s `sm:px-6/lg:px-8` on desktop, so the X icon shifted 24-32px horizontally between list and detail.
  2. Raw `` instead of `ClosePageButton` — inline-block button with block-svg content has `baseline = bottom margin edge`, growing the line box by the strut's descent (~6px) and shifting the X icon ~2px vertically vs an anchor.
  3. No `PageHeaderTitle` — without a title, the grid row shrinks to the icon's 24px height, vs 28px on pages with titles. Another 2px vertical shift.

Each deviation introduced a positioning bug we kept chasing.

Fix: just use the standard pattern. Drop the absolute positioning, use `ClosePageButton`, add a `PageHeaderTitle` showing the card/offer name. The three deviations turn into three consistencies.

`ClosePageButton`'s `transition` prop is now optional — omitting it renders a plain `` for the browser-default crossfade. The gift card routes use this mode because the cards already define their own `viewTransitionName` morphs that should not be overridden by a slide.

Visual change: detail/offer card images no longer extend behind the X icon — they start below the in-flow header. The card name now appears as the header title.

Test plan

  • Navigate `/gift-cards` ↔ `/gift-cards/{cardId}` — X icon stays put (mobile + desktop)
  • Navigate `/gift-cards` ↔ `/gift-cards/offers/{id}` — X icon stays put (mobile + desktop)
  • Navigate `/gift-cards` ↔ add-gift-card route — X icon stays put, navigation state preserved
  • Card morph animations on entering/leaving detail pages still play
  • Spot-check other pages (send, receive, settings, scan) — no regressions

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agicash Ready Ready Preview, Comment May 15, 2026 6:20pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented May 14, 2026

This pull request has been ignored for the connected project hrebgkfhjpkbxpztqqke because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from caf6248 to 4e97856 Compare May 14, 2026 23:56
@gudnuf gudnuf changed the title fix(page-header): keep X icon at fixed y-position across pages fix(page-header): use ClosePageButton so X icon stays put across gift card pages May 14, 2026
@gudnuf gudnuf changed the title fix(page-header): use ClosePageButton so X icon stays put across gift card pages fix(page-header): X icon stays put across gift card pages May 15, 2026
@gudnuf gudnuf marked this pull request as draft May 15, 2026 00:24
@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from 8ff22b3 to 7e34fa7 Compare May 15, 2026 01:03
@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from 7e34fa7 to 82f0ce6 Compare May 15, 2026 01:34
@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from 7a9c375 to 0a0e07f Compare May 15, 2026 04:09
@gudnuf gudnuf changed the title fix(page-header): X icon stays put across gift card pages fix(gift-cards): follow standard header pattern across all routes May 15, 2026
@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from 0a0e07f to 30d9bc8 Compare May 15, 2026 17:31
@gudnuf gudnuf force-pushed the fix/page-header-x-shift branch from 30d9bc8 to d1c79c8 Compare May 15, 2026 17:40
Two structural inconsistencies were drifting the X icon between
/gift-cards and its child routes:

1. Detail/offer pages used `absolute inset-x-0` headers (which escape
   Page's horizontal padding); list page used in-flow. On desktop Page
   has sm:px-6/lg:px-8, so the absolute header's X landed 24-32px left
   of the in-flow header's. Switch detail/offer/add to the same in-flow
   px-4 pattern as the list.

2. Detail/offer/add used a raw `<button onClick>` for the close action.
   <button> is display:inline-block; with only block-svg content (svg is
   `display:block` per Tailwind preflight), its baseline is at the
   bottom margin edge - the line box grows by the strut's descent and
   the X sits a couple px lower than an anchor would. Switch to
   ClosePageButton, matching every other page.

Since the cards already define their own view-transition morphs, the
close buttons shouldn't override them with a slide. Make `transition`
optional on LinkWithViewTransition/ClosePageButton - when omitted, the
component renders a plain Link with `viewTransition` for the browser-
default crossfade (same behavior as the previous `navigate('/gift-cards',
{ viewTransition: true })` call).
Drop the `Page className="px-0 pb-0"` + `PageHeader className="px-4"`
overrides on all four gift card pages. They were originally introduced
to let the list page's DiscoverGiftCards horizontal scroll extend
edge-to-edge on mobile, with the header re-adding its own padding to
keep the X icon visually offset. But this approach split horizontal
padding responsibility between Page and Header asymmetrically — and on
desktop, Page's sm:px-6/lg:px-8 still applied on top of the header's
px-4, so the X icon sat 16-32px right of where it does on every other
page in the app.

With default Page and PageHeader, the gift card pages match the standard
pattern used everywhere else. X icon position is consistent across all
routes without any responsive-padding hacks.

Tradeoff: DiscoverGiftCards and OffersSection (3+ mode) no longer extend
edge-to-edge on mobile — they sit inside Page's px-4. Inner content
sections that had their own `px-4` will also indent more (Page padding
stacks on top of theirs). Evaluating visual; may revert.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants