Skip to content

chore: refine responsive styles for hero-stats grid on mobile devices#19

Merged
hoangsonww merged 1 commit intomasterfrom
feat/enhance-index
Apr 22, 2026
Merged

chore: refine responsive styles for hero-stats grid on mobile devices#19
hoangsonww merged 1 commit intomasterfrom
feat/enhance-index

Conversation

@hoangsonww
Copy link
Copy Markdown
Owner

This pull request updates the responsive styles for the .hero-stats and .hero-stat components in wiki/styles.css to improve layout consistency and visual alignment, especially on smaller screens. The changes focus on refining grid and padding behavior, ensuring divider lines align correctly, and handling edge cases for odd numbers of stats.

Responsive layout and alignment improvements:

  • Refactored the .hero-stats grid for screens under 720px to remove vertical gaps, set padding-top: 0, and ensure vertical dividers (borders) align perfectly with the top border.
  • Updated .hero-stat items to use uniform top padding (16px), set min-width: 0, and use box-sizing: border-box for better cell alignment.
  • Changed right-column items (.hero-stat:nth-child(even)) to use a left border and left padding, ensuring the divider line connects with the top border.
  • Improved handling of the last row and lone items: removed the bottom border from the last three stats and made a lone fifth stat span the full width, center its content, and clear left-side styles.

Mobile font scaling:

  • Added a responsive font size for `.hero

@hoangsonww hoangsonww self-assigned this Apr 22, 2026
@hoangsonww hoangsonww added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers feature Feature request labels Apr 22, 2026
@hoangsonww hoangsonww merged commit 61682ec into master Apr 22, 2026
11 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the responsive styles for hero statistics in wiki/styles.css, improving the grid layout and typography for smaller screens. Review feedback identifies an issue with the border-removal logic for even-numbered grids, suggests removing redundant CSS properties already defined globally, and recommends adjusting a font-size clamp to ensure a smooth transition at the 480px breakpoint.

Comment thread wiki/styles.css
border-left: 1px solid var(--border);
}
/* Remove bottom border from last paired row AND lone item below it */
.hero-stat:nth-last-child(-n + 3) { border-bottom: 0; }
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.

high

The selector :nth-last-child(-n + 3) incorrectly removes the bottom border from the right-hand item of the second-to-last row when the total number of items is even (e.g., in a 4-item or 6-item grid). This results in an inconsistent horizontal line where one item in a row has a border and its neighbor does not. To correctly target only the last row in a 2-column layout, use a selector that accounts for the grid's flow.

  .hero-stat:last-child, .hero-stat:nth-last-child(2):nth-child(odd) { border-bottom: 0; }

Comment thread wiki/styles.css
Comment on lines +559 to +566
.hero-stat {
border-right: 0;
border-bottom: 1px solid var(--border);
/* Uniform top padding on all items keeps rows aligned within their cells */
padding: 16px 0;
min-width: 0;
box-sizing: border-box;
}
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.

medium

The properties min-width: 0 and box-sizing: border-box are already applied globally to all elements via the universal selector at the top of the stylesheet (lines 36-40). Removing them here reduces redundancy and keeps the component styles focused.

  .hero-stat  {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    /* Uniform top padding on all items keeps rows aligned within their cells */
    padding: 16px 0;
  }

Comment thread wiki/styles.css

@media (max-width: 480px) {
.hero-stats { grid-template-columns: 1fr 1fr; }
.hero-stat .n { font-size: clamp(14px, 5vw, 20px); }
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.

medium

The clamp(14px, 5vw, 20px) font-size at the 480px breakpoint causes a jump in size. At 481px, the font size is 18px (from the base rule clamp(18px, 2.1vw, 24px)), but at 480px it jumps to 20px (since 5% of 480 is 24, clamped to 20). This makes the text larger as the screen gets smaller. Adjusting the scale to start at 18px at the breakpoint ensures a smooth fluid transition.

  .hero-stat .n { font-size: clamp(14px, 3.75vw, 18px); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request feature Feature request good first issue Good for newcomers

Development

Successfully merging this pull request may close these issues.

1 participant