Skip to content

fix: consistent card heights and widths in homepage card grid#710

Open
Copilot wants to merge 4 commits into
masterfrom
copilot/fix-card-display-issues
Open

fix: consistent card heights and widths in homepage card grid#710
Copilot wants to merge 4 commits into
masterfrom
copilot/fix-card-display-issues

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Homepage card grids had two visual defects: phantom empty columns creating dead whitespace between cards, and cards in the same row rendering at different heights.

Root causes

  • DocHomeCardContainer used repeat(auto-fit, minmax(224px, 30%)). The 30% hard cap means 3 columns consume only 90% of the container, leaving a visible gap.
  • A later auto-fill change still reserved empty end-tracks, which could keep visible dead space.
  • DocHomeCard (Box component="a") had no explicit display. Anchor elements are inline by default; without display: block, grid blockification is unreliable across browsers, so cards in the same row rendered at their intrinsic heights rather than stretching to match the tallest sibling.

Changes (src/components/MDXComponents/DocHome.tsx)

  • DocHomeCardContainer now uses breakpoint-specific grid behavior:

    - gridTemplateColumns: "repeat(auto-fit, minmax(224px, 30%))",
    - justifyContent: "start",
    + gridTemplateColumns: {
    +   sm: "repeat(auto-fit, minmax(224px, 1fr))",
    +   md: "repeat(3, minmax(224px, 1fr))",
    + },
    • sm uses auto-fit + 1fr to avoid dead whitespace from empty tracks.
    • md and above enforce a fixed three-column layout for better desktop visual consistency.
  • DocHomeCard adds display: "block" so the anchor is always a block-level grid item and stretches to fill the full row height via the default align-items: stretch.

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
website-docs Error Error Jun 11, 2026 11:19am

Request Review

- Change DocHomeCardContainer gridTemplateColumns from
  repeat(auto-fit, minmax(224px, 30%)) to
  repeat(auto-fill, minmax(224px, 1fr)):
  * 1fr distributes space equally so all columns are the same width
  * auto-fill keeps empty end-tracks so last-row cards stay the same
    width as cards in full rows (no stretching)
- Add display: block to DocHomeCard (Box component="a") so the anchor
  element reliably fills the full grid-cell height via the default
  align-items: stretch
Copilot AI changed the title [WIP] Fix inconsistent card heights and spacing on doc site homepage fix: consistent card heights and widths in homepage card grid Jun 11, 2026
Copilot AI requested a review from lilin90 June 11, 2026 08:09
@lilin90 lilin90 marked this pull request as ready for review June 11, 2026 08:18
@lilin90 lilin90 requested review from Copilot and shhdgit June 11, 2026 09:20
@lilin90

lilin90 commented Jun 11, 2026

Copy link
Copy Markdown
Member

@copilot It seems that the card spacing issue hasn't been resolved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the homepage documentation “card grid” styling to eliminate inconsistent gaps and ensure cards in the same row render with consistent widths/heights across browsers.

Changes:

  • Updated DocHomeCardContainer grid columns to repeat(auto-fill, minmax(224px, 1fr)) and removed justifyContent: "start" to better distribute column widths.
  • Set DocHomeCard (anchor) to display: "block" to ensure reliable grid-item stretching behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot It seems that the card spacing issue hasn't been resolved.

Updated in commit 8859a3b. I switched the card grid from auto-fill to auto-fit (repeat(auto-fit, minmax(224px, 1fr))) so empty end-tracks no longer reserve space and the dead spacing between cards is removed.

@lilin90

lilin90 commented Jun 11, 2026

Copy link
Copy Markdown
Member

@copilot For a better visual experience, please keep the three-column layout.

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot For a better visual experience, please keep the three-column layout.

Updated in commit e4815ba. Desktop card grids now keep a three-column layout (md: repeat(3, minmax(224px, 1fr))), while smaller widths still use responsive auto-fit behavior.

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.

Doc site homepage card display issues: inconsistent card width and spacing

3 participants