fix: align and size specific card thumbnails uniformly on resources page - #7914
fix: align and size specific card thumbnails uniformly on resources page#7914dhruveshmishra wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes thumbnail sizing/alignment/cropping on the resources page by introducing per-card image styling and ensuring SVG thumbnails can be constrained via wrapper styles.
Changes:
- Add title-based dynamic
imgStyle(objectFit/padding/objectPosition/etc.) inCardfor specific resource thumbnails. - Allow passing custom
styledown to the SVG wrapper inImageso SVGs can be sized consistently.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/components/image.js | Enables custom wrapper styling for SVG images to support consistent sizing constraints. |
| src/components/Card/index.js | Adds per-title thumbnail layout rules to normalize card grid appearance. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCard now computes title-specific image layouts for non-list cards. The ChangesCard image presentation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/Card/index.js (1)
17-58: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse a stable identifier for the image layout map.
If a title changes, the card can fall back to default
coverandcenterstyling. Key these rules fromfields.slugor an explicit frontmatter layout value.🤖 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 `@src/components/Card/index.js` around lines 17 - 58, Update the image layout conditions in the Card component to use a stable identifier such as fields.slug or an explicit frontmatter layout value instead of comparing display title strings. Preserve the existing contain/cover, padding, dimensions, and objectPosition behavior for each mapped image layout.
🤖 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 `@src/components/image.js`:
- Around line 32-41: Update the GatsbyImage invocation in the image component to
forward objectFit and objectPosition as top-level props, reusing the values
supplied through imgStyle so the placeholder uses the same crop as the main
image. Keep the existing imgStyle handling intact.
---
Nitpick comments:
In `@src/components/Card/index.js`:
- Around line 17-58: Update the image layout conditions in the Card component to
use a stable identifier such as fields.slug or an explicit frontmatter layout
value instead of comparing display title strings. Preserve the existing
contain/cover, padding, dimensions, and objectPosition behavior for each mapped
image layout.
🪄 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: 846437e3-d1e6-41da-ae11-8dca85f14f78
📒 Files selected for processing (2)
src/components/Card/index.jssrc/components/image.js
|
Nice fix, grid looks way more balanced in the recording 👍 |
Signed-off-by: dhruveshmishra <dhruveshmishra09@gmail.com>
7b9d3b0 to
5838367
Compare
|
@ghosthouse7 It was intentional. The card showing the Docker logo is titled "Managing Containers" in the codebase, and it is included in the Set lookup! |
|
@Bhumikagarggg @Sbragul26 @YASHMAHAKAL @rishiraj38 In my local the preview and lint is working fine but here it is failing can someone please check |
Ah gotcha, missed that — thanks for clarifying, makes sense 👍 |
…ter loading transitions Signed-off-by: dhruveshmishra <dhruveshmishra09@gmail.com>
|
@rishiraj38 @Sbragul26 @Bhumikagarggg please take a look on it |
|
🚀 Preview deployment: https://layer5.io/pr-preview/pr-7914/ |
Signed-off-by: Dhruvesh Mishra <dhruveshmishra09@gmail.com>
This pr fixes #7817
Description
This PR fixes sizing, alignment, and cropping issues on specific card thumbnails (Kubernetes, Docker, CCOSS, and O'Reilly courses) on the resources page to ensure a visually balanced grid.
Changes
Dynamic Sizing in React: Dynamically calculates image layout styling in Card/index.js based on card titles, passing objectFit, padding, and objectPosition inline to avoid global CSS styling overrides.
SVG Wrapper Support: Spreads custom styles to the SVG wrapper in image.js to allow proper height and width constraints on vector graphics.
Screen recording
Screen.Recording.2026-08-03.at.3.22.08.PM.mov
Summary by CodeRabbit