Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: centered card in casestudies page #3805

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cbum-dev
Copy link

@cbum-dev cbum-dev commented Mar 6, 2025

Description

-fixes #3788

Screenshots
Case1: When items is more than 2
Screenshot From 2025-03-06 12-54-52
Case1: When items is less than or equal to 2
Screenshot From 2025-03-06 12-55-04

Summary by CodeRabbit

  • Style
    • Updated the arrangement of case study cards to provide a more flexible, centered layout on larger screens.
    • Adjusted card dimensions to improve the visual presentation on large displays.

Copy link
Contributor

coderabbitai bot commented Mar 6, 2025

Walkthrough

The changes update the layout in the CaseStudyCard component. The outer <div> class has been modified by removing the grid layout classes and replacing them with a justify-center class, while the anchor <a> element now includes a class lg:w-[30%] for width specification on large screens. These updates adjust the visual presentation of the case study cards without affecting their functionality or data handling.

Changes

File(s) Change Summary
components/CaseStudyCard.tsx Updated outer <div> class by removing lg:grid lg:grid-cols-3 and adding justify-center; added lg:w-[30%] to the anchor <a> element for width control on large screens.

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • magicmatatjahu
  • devilkiller-ag
  • akshatnema
  • sambhavgupta0705
  • Mayaleeeee
  • anshgoyalevil

Poem

(_/) I'm a little rabbit with a coding spark,
Hopping through changes that light up the dark.
Grid becomes flex, with widths that now shine,
Each tweak is a hop in this design divine.
Carrots and code – a joyful, rhythmic line!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f051a96 and 08df39e.

📒 Files selected for processing (1)
  • components/CaseStudyCard.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/CaseStudyCard.tsx
⏰ Context from checks skipped due to timeout of 180000ms (1)
  • GitHub Check: Test NodeJS PR - macos-13

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 08df39e
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67cc948725176a000866266e
😎 Deploy Preview https://deploy-preview-3805--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (87ace8a) to head (08df39e).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3805   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          667       667           
  Branches       113       113           
=========================================
  Hits           667       667           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cbum-dev cbum-dev changed the title fixes centered card fix: centered card in casestudies page Mar 6, 2025
Copy link
Member

@sambhavgupta0705 sambhavgupta0705 left a comment

Choose a reason for hiding this comment

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

@@ -19,11 +19,11 @@ export default function CaseStudyCard({ studies = [] }: ICaseStudyCardProps) {
}

return (
<div className='flex flex-wrap gap-3 pt-10 lg:grid lg:grid-cols-3 lg:gap-8 lg:text-center'>
<div className='flex flex-wrap gap-3 pt-10 lg:flex lg:items-center lg:justify-center lg:gap-8 lg:text-center'>
Copy link
Member

Choose a reason for hiding this comment

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

Since we are using flex for all viewports, can't we simplify this to use flex in all viewports?

@coderabbitai can you suggest something here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@akshatnema You're absolutely right! Since we're using flex layout for all viewports now, we can simplify this by removing the redundant lg:flex. Here's a simplified version:

<div className='flex flex-wrap gap-3 pt-10 lg:items-center lg:justify-center lg:gap-8 lg:text-center'>

This removes the duplicate flex declaration while preserving all the functionality.

If you want items centered on all viewports (not just large screens), you could further simplify to:

<div className='flex flex-wrap items-center justify-center gap-3 pt-10 lg:gap-8 lg:text-center'>

This would depend on the desired mobile layout - does it need center alignment everywhere or just on larger screens?

Copy link
Member

Choose a reason for hiding this comment

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

@cbum-dev Can you please make this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

{studies.map((study, index) => (
<a key={index} href={`casestudies/${study.id}`}>
<div
className='h-full min-h-[300px] max-w-sm overflow-hidden rounded-md border border-gray-200 bg-white p-4'
className='h-full min-h-[300px] max-w-sm overflow-hidden lg:w-[350px] rounded-md border border-gray-200 bg-white p-4'
Copy link
Member

Choose a reason for hiding this comment

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

@coderabbitai Can we do this somewhat better instead of hardcoding it?

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for case study implementations
echo "=== Searching for case study implementations ==="
rg -A 5 -B 5 "CaseStudyCard" --type tsx --type jsx

# Search for similar card components in the codebase
echo "=== Searching for other card components ==="
fd "Card.tsx" --type f

# Look at the issue this PR is fixing
echo "=== Checking for the issue reference in PR description ==="
gh pr view 3805 --json body | jq -r '.body'

# Check for other responsive card layouts in the codebase
echo "=== Looking for responsive width patterns in other card components ==="
rg "className=.*w-\[" --type tsx --type jsx

Length of output: 2201


🏁 Script executed:

#!/bin/bash
# Search for case study implementations with correct file types
echo "=== Searching for case study implementations ==="
rg "CaseStudyCard" --type-not md

# Check issue #3788 which this PR fixes
echo "=== Checking issue #3788 ==="
gh issue view 3788 --json title,body | jq -r '"\(.title)\n\n\(.body)"'

# Looking for responsive width patterns in other components
echo "=== Looking for responsive width patterns ==="
rg "className.*w-\[" --type-not md

# Check similar responsive design patterns in other card components
echo "=== Examining responsive design in other card components ==="
fd "Card.tsx" -e tsx -e jsx --exec cat {} | head -n 50

Length of output: 7924


@akshatnema Yes, we can improve this implementation by avoiding the hardcoded width. Instead of using lg:w-[350px], here are some better alternatives:

  1. Use a relative width with flex-basis:
className='h-full min-h-[300px] max-w-sm overflow-hidden lg:basis-1/3 lg:max-w-[350px] rounded-md border border-gray-200 bg-white p-4'
  1. Use a percentage-based width that will scale with the container:
className='h-full min-h-[300px] max-w-sm overflow-hidden lg:w-[30%] rounded-md border border-gray-200 bg-white p-4'
  1. Let the content determine the width with flex-grow and constraints:
className='h-full min-h-[300px] max-w-sm overflow-hidden lg:flex-grow lg:max-w-[350px] rounded-md border border-gray-200 bg-white p-4'

Any of these approaches would be more adaptable to different screen sizes while still maintaining the centered layout that was needed to fix the original issue.

Copy link
Author

Choose a reason for hiding this comment

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

@coderabbitai Can we do this somewhat better instead of hardcoding it?

Ok let me check which one works best.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cbum-dev Great! Looking forward to seeing which approach works best for your use case. Let me know if you need any further assistance with implementing these alternatives.

@sambhavgupta0705
Copy link
Member

@cbum-dev it is maintainer's task to resolve the threads as by this we keep a track of what comments we have added or not
Please don't resolve the comments if the maintainer hasn't asked it

@cbum-dev
Copy link
Author

Sorry @sambhavgupta0705 I'll keep that in mind.

@sambhavgupta0705
Copy link
Member

Kindly mark them as unresolved

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.

[BUG] Cards not centered on case studies page
4 participants