Skip to content

Story 2432: Hero Section Refactor#2476

Open
julioest wants to merge 14 commits into
boostorg:developfrom
julioest:2432-hero-section-refactor
Open

Story 2432: Hero Section Refactor#2476
julioest wants to merge 14 commits into
boostorg:developfrom
julioest:2432-hero-section-refactor

Conversation

@julioest

@julioest julioest commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Issue: #2432

Refactors the v3 hero section on the homepage and community pages: centralizes the header overlay, rebuilds the hero as a tokenized, modifier-driven layout over a background image with a gradient, and moves the hero image URLs into the views.

Changes

  • Pulled the absolute-positioned v3 header into a single body.v3 .header rule with a padding reservation, removing the duplicated copies from the auth, library subpage, and release detail stylesheets.
  • Rebuilt the hero as a flex layout over a background image with a gradient overlay, with the foreground mascot floating per page; page-specific styling lives in modifier classes (--community, --release, etc.) so page stylesheets no longer reach into hero internals.
  • Tokenized the responsive layout per hero and per tier: foreground sizing/anchor (--hero-fg-*), background scale and focal point (--hero-bg-*), and the hero block height (--hero-library-block-height), each set once per breakpoint.
  • Home hero: pinned the headline to a fixed line count per breakpoint, made the foreground theme-aware (light/dark), tuned sizing and position across breakpoints, and added a tighter mobile crop via <picture>.
  • Community hero: switched the mascots to the home-style wide-contain foreground over a taller room background anchored low, tuned per breakpoint, and added a tightly-cropped mobile mascot. This required adding <picture> mobile-source support to the shared library hero template.
  • Fixed the mascot asset naming: swapped the foreground files so each filename matches its art, and repointed the homepage and community views accordingly.
  • Moved the hero foreground and background image URLs from the templates into the homepage and community views.
  • Reorganized heros.css into labeled sections (tokens, shared, home, library, variants), base rules before media queries, behavior-preserving.

Risks

  • The new and swapped hero art (foregrounds, taller backgrounds, mobile crops) lives in S3 and is gitignored, so it is not part of this PR. It must be uploaded to all buckets in step with the deploy (after merge), or production will render the old or mismatched art.
  • Header overlay positioning depends on the body carrying the v3 class.

Screenshots

Homepage

Desktop Tablet Mobile
Light
Dark

Community

Desktop Tablet Mobile
Light
Dark

Self-review Checklist

  • Tag at least one team member from each team to review this PR
  • Link this PR to the related GitHub Project ticket

Frontend

  • UI implementation matches Figma design
  • Tested in light and dark mode
  • Responsive / mobile verified
  • Accessibility checked (keyboard navigation, etc.)
  • Ensure design tokens are used for colors, spacing, typography, etc. – No hardcoded values
  • Test without JavaScript (if applicable)
  • No console errors or warnings

Summary by CodeRabbit

  • New Features

    • Mobile-specific hero images and responsive picture support for light/dark variants
    • New hero background images and page-specific hero variants (community, release)
  • Improvements

    • Redesigned, token-driven responsive hero layouts for better art direction across breakpoints
    • Header overlays on V3 pages adjusted to prevent content overlap
    • Consolidated and reorganized hero and page styling for more consistent behavior

julioest added 3 commits June 1, 2026 10:14
The absolute-positioned header that overlays the hero was copy-pasted
into four different page stylesheets. This pulls it up into one
body.v3 rule in header.css, and adds a matching padding reservation so
pages without a hero don't shift when the header leaves the flow.

Heads up: this relies on the body carrying the v3 class, which it does
when the v3 flag is active.
Hero backgrounds now cover the container with a left-to-right dark
gradient so the headline stays legible over the artwork. The block is a
fixed-height flex row with the foreground image anchored to the left,
the community page centers its mascot instead, and the old full-bleed
homepage override is gone. The redundant per-page header rules that
these two pages still carried are dropped here too.
The views now own the hero foreground and background URLs instead of
the templates hardcoding them, with hero_background_image_url added to
the shared mock data.

Heads up: the homepage and community heroes intentionally use each
other's named assets (homepage pulls community-foreground, etc.), so
the file names won't match the page they render on.
julioest added 4 commits June 3, 2026 11:57
Drive hero fg/bg size and placement with --hero-fg-* / --hero-bg-*
tokens redefined per breakpoint, replacing the hardcoded sizes and
background-position values in the media queries. Homepage mascot
centers on desktop and tablet, pins bottom-right on mobile.
Move community and release hero styling out of community.css and
release-detail.css into heros.css as .hero-library--mascot and
.hero-library--release, applied via a new extra_classes param on the
library hero include. The hero no longer keys off page wrappers like
.community-v3, and page CSS no longer reaches into it.
The homepage hero headline now wraps onto a deliberate three lines instead of flowing freely. Desktop and tablet break after "the" and "community."; mobile breaks differently, after "C++" and "by", via a second set of line breaks that swap in below 768px. I also dropped the tablet headline from 64px to 40px, since the full desktop size overflows once the install card is hidden on tablet. Worth knowing: the forced breaks apply to the default headline text only, so any page passing its own headline to the include still wraps naturally.
Home and community were sharing the foreground size and background-position tokens, so tuning one silently resized or repositioned the other. This splits them: each hero gets its own --hero-fg-{home,community} size, its own x-anchor, and its own --hero-bg-{home,community}-position. The community variant is renamed from --mascot to --community so the class reads by page instead of by visual gimmick. Home also gets a tunable horizontal nudge plus a max-width guard so the mascot stops running off-screen on tablet once it grows past the viewport. Community is restored to its original 488x416 / 350x300 sizing, which the shared tokens had been blowing up.
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors hero image asset handling and layout across the Boost website v3. It introduces a shared background image resource, consolidates header positioning into centralized v3 rules, builds a responsive CSS token system for hero layout, and updates templates to support mobile-specific images via picture elements and CSS class modifiers.

Changes

Hero assets and responsive layout refactor

Layer / File(s) Summary
Shared hero resources and view context
core/mock_data.py, ak/views.py, core/views.py
SharedResources.hero_background_image_url is added, and HomepageView and CommunityView context data now provide desktop, light, dark, and mobile hero image URLs via large_static() for template rendering.
Header overlay positioning consolidation
static/css/v3/header.css, static/css/v3/v3-homepage.css, static/css/v3/auth-page.css, static/css/v3/library-subpage.css, static/css/v3/release-detail.css, static/css/v3/community.css
Header overlay styling is centralized in header.css with v3-specific absolute positioning, z-index, and full-width anchoring; redundant per-page header rules are removed from auth, homepage, library-subpage, and release stylesheets. Community page adds overflow-x: clip to prevent hero foreground scrollbars.
Responsive CSS token system and hero styling
static/css/v3/heros.css
A :root CSS variable token system is introduced with breakpoint-driven overrides (tablet ≤1279, mobile ≤767) to control hero foreground positioning and sizing. .hero-home and .hero-library are refactored to consume tokens for background positioning and sizing. Mobile layout switches to margin-top: auto image pinning with adjusted headline/action spacing. New page-specific variants .hero-library--community and .hero-library--release are added, with mobile-specific overflow clipping and scaled image handling for the community foreground.
Responsive image support and template updates
templates/v3/includes/_hero_home.html, templates/v3/includes/_hero_library.html, templates/v3/homepage.html, templates/v3/community.html, templates/v3/examples/_v3_example_section.html, templates/v3/release_detail.html
Hero templates now use <picture> elements with mobile-specific sources (max-width 767px), adding support for hero_image_url_mobile art direction. Headline rendering switches to conditional <br> breaks. Hero library template adds extra_classes modifier support. All page templates pass updated background and image URL context through includes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • boostorg/website-v2#2446: Modifies CommunityView.get_v3_context_data (this PR also changes that function to add hero image URL context fields).

Suggested reviewers

  • herzog0
  • jlchilders11
  • kattyode

Poem

🐰 A hero's journey starts with assets shared,
Headers float above, with careful care declared,
Tokens shape the view from tablet down to phone,
Pictures swap in crops so each screen feels like home,
The v3 hero strides—responsive and prepared.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Story 2432: Hero Section Refactor' clearly identifies the main change: a comprehensive refactor of the v3 hero section components on homepage and community pages.
Description check ✅ Passed The PR description includes issue reference, detailed summary with Figma links, comprehensive changes list, identified risks, responsive screenshots across light/dark modes and breakpoints, and self-review checklist with most items completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

julioest added 6 commits June 9, 2026 02:19
Serve a tightly-trimmed foreground on mobile via a <picture> source so it stops letterboxing on narrow screens, and pin it in normal flow to the bottom of the 600px hero with aspect-ratio sizing. Desktop and tablet are untouched (same image, same layout).
The home cow and community moose were stored under each other's filenames, so each view pointed at a wrong-named file to render the right art. I swapped the two foreground PNGs so the names match the contents, and repointed HomepageView and CommunityView accordingly.
Anchor the background low for the new taller room image, scale and reposition the cow on desktop, make the tablet foreground fluid so it scales with the viewport, pin it to the bottom on narrow mobile, and switch the mobile overlay to a top-darkening gradient.
Nudge the cow 10% to the right and move the mobile background focal point to 80% so the scene frames the way we want at phone widths.
Group the stylesheet into tokens, shared, home, library, and variants, with base rules before media queries in each hero, and consistent indentation. Drop a dead tablet rule that never applied. No visual change.
Reworks the community hero to the home-style treatment. The foreground mascots now use a wide contain box anchored bottom-right (driven by the --hero-fg-community-* tokens) instead of the old small fixed box, with per-tier sizing and position for desktop, tablet, and mobile, and the background is anchored low so the racks and floor sit behind them.

Adds <picture> mobile-source support to the shared library hero template and wires a tightly-cropped mascot image for mobile via CommunityView, so the pair reads large on phones instead of tiny in the wide canvas. The community wrapper clips horizontal overflow so the oversized mobile mascot box never produces a scrollbar.

Heads up: the swapped community art (foreground, taller background, mobile crop) lives in S3 and is gitignored, so this commit carries only the code. Those assets need uploading to all buckets before this merges, alongside the home assets already pending.
@julioest julioest marked this pull request as ready for review June 10, 2026 17:11
@julioest julioest requested a review from rbbeeston June 10, 2026 17:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@static/css/v3/heros.css`:
- Around line 150-153: The CSS rule for .hero-home--no-image contains redundant
background declarations causing stylelint's
declaration-block-no-shorthand-property-overrides: remove the explicit
background-image: none declaration and keep the shorthand background: none (or
vice versa if you prefer the longhand), and apply the same change to the other
occurrence (the similar block at lines around 499-502) so no shorthand
immediately overrides a longhand.

In `@templates/v3/includes/_hero_home.html`:
- Line 16: The inline comment text for hero_image_url_mobile contains an
unescaped '<' in the string "<=767px" which triggers the HTMLHint
spec-char-escape rule; update the comment in
templates/v3/includes/_hero_home.html (the hero_image_url_mobile description) to
escape the character (e.g. replace "<" with "&lt;") so the comment reads
"&lt;=767px" and clears the linter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68055739-52df-48cc-a26b-05817f340585

📥 Commits

Reviewing files that changed from the base of the PR and between f71f5d2 and 4089b3c.

📒 Files selected for processing (16)
  • ak/views.py
  • core/mock_data.py
  • core/views.py
  • static/css/v3/auth-page.css
  • static/css/v3/community.css
  • static/css/v3/header.css
  • static/css/v3/heros.css
  • static/css/v3/library-subpage.css
  • static/css/v3/release-detail.css
  • static/css/v3/v3-homepage.css
  • templates/v3/community.html
  • templates/v3/examples/_v3_example_section.html
  • templates/v3/homepage.html
  • templates/v3/includes/_hero_home.html
  • templates/v3/includes/_hero_library.html
  • templates/v3/release_detail.html
💤 Files with no reviewable changes (3)
  • static/css/v3/auth-page.css
  • static/css/v3/library-subpage.css
  • static/css/v3/v3-homepage.css

Comment thread static/css/v3/heros.css
Comment thread templates/v3/includes/_hero_home.html Outdated
@julioest

Copy link
Copy Markdown
Collaborator Author

@rbbeeston here's the preview url https://hero-refactor-2432.ngrok.app/

CodeRabbit flagged two lint nits on the hero work. The no-image hero rules set background-image: none right before background: none, which trips stylelint's shorthand-override rule, so I dropped the redundant longhand. The mobile-image doc comments had a literal <=767px that HTMLHint rejects for the unescaped <, so I escaped it to &lt;=767px in both hero includes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
templates/v3/includes/_hero_home.html (1)

43-43: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove loading="lazy" from both hero images (light and dark). Hero images are LCP elements and appear above the fold. Lazy loading defers their load and degrades Web Vitals. Use loading="eager" or omit the attribute on both the light (line 43) and dark (line 48) <img> tags.

⚡ Proposed fix
-        <img alt="" class="hero-home__img hero-home__img--light" src="{{ hero_light }}" loading="lazy" decoding="async">
+        <img alt="" class="hero-home__img hero-home__img--light" src="{{ hero_light }}" decoding="async">
-        <img alt="" class="hero-home__img hero-home__img--dark" src="{{ hero_dark }}" loading="lazy" decoding="async">
+        <img alt="" class="hero-home__img hero-home__img--dark" src="{{ hero_dark }}" decoding="async">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@templates/v3/includes/_hero_home.html` at line 43, Remove lazy loading from
the hero images: locate the two <img> tags with classes hero-home__img
hero-home__img--light and hero-home__img hero-home__img--dark and either delete
the loading="lazy" attribute or change it to loading="eager" so the LCP hero
images load immediately (apply the same change to both light and dark hero <img>
tags).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@templates/v3/includes/_hero_home.html`:
- Line 43: Remove lazy loading from the hero images: locate the two <img> tags
with classes hero-home__img hero-home__img--light and hero-home__img
hero-home__img--dark and either delete the loading="lazy" attribute or change it
to loading="eager" so the LCP hero images load immediately (apply the same
change to both light and dark hero <img> tags).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bbbc25be-c786-4d8f-9d6d-8fdf27c479ca

📥 Commits

Reviewing files that changed from the base of the PR and between 4089b3c and a673932.

📒 Files selected for processing (3)
  • static/css/v3/heros.css
  • templates/v3/includes/_hero_home.html
  • templates/v3/includes/_hero_library.html
💤 Files with no reviewable changes (1)
  • static/css/v3/heros.css
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/v3/includes/_hero_library.html

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.

Component: Hero Section (Home and Community) - Image and code refactoring

1 participant