fix: resolve card overflow and layout issues in Learn page sections
Description This PR fixes #7807
This PR fixes two layout issues on the layer5.io/learn page where card sections were not displaying properly on desktop screens.
Issue 1: Learning Paths cards overflow
File: src/sections/Learn/LearnPage-Sections/learning-path.js
The three cards in this section did not have proper width settings for desktop screens, so they were overflowing the row and getting clipped on the sides.
Fix: Added the missing width settings ($md, $lg, $xl props) to the Col component so all three cards now fit properly within the row on all desktop screen sizes.
Issue 2: Workshops cards collapse to 2 columns
File: src/sections/Learn/LearnPage-Sections/workshops.js
The workshop cards were missing width settings for some desktop screen sizes, and an existing CSS rule was forcing them into a 2-column layout. This pushed the third card off-screen.
Fix:
- Added the missing width settings to the
Colcomponent. - Replaced the hardcoded card width value with a CSS variable, so it's easy to update later if the number of cards changes.
Bonus fix: Cards were different sizes
While testing, I noticed the cards were also showing up in different sizes instead of being equal.
Fix: Removed a margin: auto rule that was causing uneven spacing, and made sure all card images use the same width and crop style so every card looks consistent.
Testing
- Ran
npm run build— build completed successfully with no errors. - Tested locally with
gatsby developon both desktop and mobile screen sizes. All cards now show up at equal sizes with even spacing, no overflow, and no unexpected column changes.
Notes for Reviewers
- [x] Yes, I signed my commits.
Preview deployment for PR #7813 removed.
This PR preview was automatically pruned because we keep only the 6 most recently updated previews on GitHub Pages to stay within deployment size limits.
If needed, push a new commit to this PR to generate a fresh preview.
@Rajesh-Nagarajan-11
Hi @Sbragul26
I took a closer look at the mobile card sizing issue. The desktop layout is now working as expected, but the second card still appears a bit smaller on mobile.
From what I found, the issue doesn't seem to be coming from the CSS. The three thumbnail images have different aspect ratios, which makes the cards look visually uneven.
I don't think we can completely solve this with CSS alone without creating other visual compromises elsewhere.
@Rajesh-Nagarajan-11 @Sbragul26
@AnkitRewar11, can you please push a new commit to generate a fresh preview.
@AnkitRewar11, can you please push a new commit to generate a fresh preview.
done
@AnkitRewar11 Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would :slightly_smiling_face:
@Sbragul26, the content cut-off issue on mobile is resolved. The remaining slight height difference between cards is an asset issue. The three thumbnails have different aspect ratios. We can create a separate issue to standardise the thumbnail image dimensions.
@AnkitRewar11, it looks good to me.
@AnkitRewar11, can you please push a new commit to generate a fresh preview. Also an essential check that supports deployment is failing,do look into it.
@AnkitRewar11 , The overflow issue looks fixed. One minor observation: compared to the previous layout, the cards now occupy noticeably less horizontal space on larger desktop screens, leaving more empty space on the sides. Was this intentional? If not, we could consider slightly increasing the card width or adjusting the layout to make better use of the available space.
I have attached the screenshots of before and after for reference.
Before:
After:
@AasthathecoderX Thanks for pointing this out. It wasn’t intentional. I’ve updated the container and card layout so the cards now use the available desktop space more effectively while remaining responsive. Please take another look.