Repository navigation
fix(hub): align screenshot previews with capture dimensions - #365
Merged
Merged
Conversation
Share desktop and narrow viewport dimensions between capture, package checks, and Hub thumbnail frames. Preserve full-page screenshots and their scrolling previews. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Missing final Storybook screenshots and a running preview URL prevent human visual review of cropping, tall-page scrolling, and fallback states affected by the shared preview ratio changes.
No open issues 🎉
What changed in this PR
This PR aligns Hub screenshot previews with the build action’s capture dimensions, preventing short pages from being enlarged and cropped by mismatched card frames.
Changes:
- Centralizes viewport dimensions for capture, package validation, and Hub preview ratios.
- Updates cards, template-picker thumbnails, and Storybook frames while preserving scrolling for taller pages.
- Expands capture regression coverage for short root and template pages across both themes and viewport sizes.
Complete Hub verification and uploaded Storybook screenshot evidence remain unresolved, as noted in the draft description.
| File | Description |
|---|---|
hub/docs/github-actions-builds.md |
Documents shared dimensions and capture-setting updates. |
hub/client/utils/screenshot-viewports/viewports.json |
Defines shared desktop and narrow dimensions. |
hub/client/utils/screenshot-viewports/index.ts |
Exposes aspect-ratio styles derived from shared dimensions. |
hub/client/components/template-picker/styles.css |
Removes the fixed thumbnail height. |
hub/client/components/template-picker/index.tsx |
Applies the shared desktop ratio to thumbnails. |
hub/client/components/template-card/stories.tsx |
Adds a short-page Starter example. |
hub/client/components/template-card/index.tsx |
Applies the shared desktop ratio to template previews. |
hub/client/components/scrolling-screenshot/stories.tsx |
Uses shared ratios for story frames. |
hub/client/components/prototype-card/styles.css |
Removes independently defined preview ratios. |
hub/client/components/prototype-card/index.tsx |
Applies the shared desktop ratio to prototype previews. |
actions/build/scripts/constants.mjs |
Derives build viewports from the shared settings. |
actions/build/scripts/capture-screenshots/index.test.mjs |
Checks short-page dimensions across routes, themes, and viewports. |
Review effort: Balanced (adaptive)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The build captures desktop screenshots at 1440 x 900 or taller, but prototype and template cards used a taller frame. Short pages, including the Starter, were enlarged and cropped to fill that frame.
What changes
One shared viewport file now supplies capture dimensions, minimum-size package checks, and Hub's prototype-card, template-card, and template-picker frame ratios. Existing desktop and narrow dimensions stay unchanged. Full-page capture and hover, focus, and manual scrolling remain available for taller pages.
The Storybook frames use the shared ratios too. A Default template-card story makes the Starter's short page visible alongside the existing long-page examples. The capture regression covers short root and template pages in both themes and viewport sizes.
Storybook screenshots
This remains a draft because complete Storybook screenshot attachments are unavailable. The session has no GitHub media-upload tool or
github-pr-mediaskill. The configured Playwright fallback also lacks its Chrome executable. The integrated browser rendered the Starter card, viewport-height and full-page screenshots, and the Create page with its template picker open; those captures are visible in the session but are not GitHub attachments.Screenshot evidence still required