Skip to content

fix(theme): keep the page card clear of the full-bleed hero - #189

Merged
wen-templari merged 2 commits into
mainfrom
fix/hero-card-spacing-mobile
Sep 28, 2026
Merged

wen-templari merged 2 commits into
mainfrom
fix/hero-card-spacing-mobile

Conversation

@Yuna-Celisse

Copy link
Copy Markdown
Contributor

Closes #182

Summary

/repair/ and the other hero pages had the page card (维护 / 最近 / 在本页编辑) cut off by the hero photo at narrow viewports.

The hero escapes the doc's top padding with margin-top: -32px so it can bleed under the nav. Below the outline breakpoint the card is mounted in doc-before, directly ahead of it, and adjacent margins collapse the card's 20px bottom margin with that pull into -12px — the photo then overlaps the card by 12px. The rule gives the pair a real 20px gap where the card is the hero's preceding sibling, scoped to screen and to widths under 1280px, since above that the card moves to the aside and the bleed is unchanged.

Scope

  • Assets or templates

Checklist

  • I updated the relevant sidebar or confirmed no navigation change is needed.
  • I checked internal links and asset paths affected by this PR.
  • I kept historical archived content unchanged unless this PR is explicitly about archive maintenance.
  • I documented follow-up work that is intentionally outside this PR.

Verification

  • pnpm run ci:lint — ci:lint:eslint and ci:lint:markdown both clean
  • pnpm test -- --run — 156 passed; the 2 failures reproduce on a clean main checkout and are Windows CRLF artifacts (maintainers:\r\n misses the regex, and git hash-object disagrees with the CRLF working tree)
  • pnpm docs:build

Layout measured in the browser rather than by eye: at a 390px viewport the card-to-content gap was -12px before and is 20px after on /repair/, /about/what-is-nbtca, /concepts/ and /repair/guide; at 1360px the hero keeps margin-top: -32px.

Notes

Two things found while measuring, deliberately left out of this PR:

  1. The hero's width: 100vw is wider than the content box whenever the viewport has a classic scrollbar, so those pages scroll sideways by ~8px (scrollWidth 383 vs clientWidth 375 at 390px). Invisible on mobile browsers with overlay scrollbars. Fixing it properly means dropping 100vw for negative margins plus width: auto, as the has-sidebar rule already does.
  2. aside: false pages (/repair/, /about/what-is-nbtca) render no card at all at ≥1280px: the inline card is hidden and the aside column itself is not mounted, so the maintainer card disappears on wide screens.

The hero pulls itself up by the doc's top padding to reach the nav. Below
the outline breakpoint the card is mounted ahead of it in doc-before, and
adjacent margins collapse the card's 20px bottom margin with that pull
into -12px, so the photo cut the card's bottom edge off.

Give the pair a real gap where the card is the hero's preceding sibling.
Above 1280px the card moves to the aside and the pull stays as it was, so
the rule is scoped to screen widths below that breakpoint.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Deploying documents with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4b74f5f
Status: ✅  Deploy successful!
Preview URL: https://e09a332e.documents-dq4.pages.dev
Branch Preview URL: https://fix-hero-card-spacing-mobile.documents-dq4.pages.dev

View logs

@wen-templari

wen-templari commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Please make vertical spacing consistent around the edit card.
image

The card had the doc's top inset above it and 20px below, which read as the
photo crowding the card. Name the inset once and reuse it, so the two sides
agree at both of the widths where .VPDoc changes its padding.
@Yuna-Celisse

Copy link
Copy Markdown
Contributor Author

@wen-templari thanks — the two gaps were 32px above the card and 20px below it. Now the hero takes the same inset the card sits under, so both sides agree: 32/32 below 768px and 48/48 above it, where .VPDoc widens its own padding. Measured in a 390x844 viewport on /repair/ and /about/what-is-nbtca, and at 820px on /repair/.

The value is named once as --nb-doc-top rather than repeated, so the pairing stays true if the inset changes again. Above 1280px nothing moved: the card goes to the aside and the hero keeps bleeding to the top.

4b74f5f is up; the preview will be rebuilt when it lands.

@wen-templari
wen-templari merged commit e77eb9b into main Sep 28, 2026
5 checks passed
@wen-templari
wen-templari deleted the fix/hero-card-spacing-mobile branch September 28, 2026 00:21
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.

Missing spacing at mobile viewport

2 participants