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: normalize the logos of sponsors #3534

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

Conversation

29deepanshutyagi
Copy link

@29deepanshutyagi 29deepanshutyagi commented Jan 1, 2025

Fixes issue #3158

I've made the following changes to normalize the sponsor logos:

  1. Created a new SponsorImage component that:
    Wraps the image in a flex container for consistent alignment
    Uses max-h-9 (36px) for mobile and max-h-12 (48px) for larger screens
    Maintains aspect ratio with w-auto and object-contain

  2. Use the new SponsorImage component
    Maintain existing layout and responsive behavior

  3. These changes will ensure that:
    All sponsor logos have consistent maximum heights
    Logos maintain their aspect ratios
    The layout remains responsive
    The HDI logo will be properly constrained to match other sponsor logos

Summary by CodeRabbit

  • New Features

    • Introduced a new SponsorImage component for consistent and centralized sponsor logo rendering.
    • Enhanced sponsor section with improved image display across Gold and Silver sponsor components.
  • Refactor

    • Replaced direct <img> tags with a reusable SponsorImage component in sponsor sections.
    • Standardized JSX attribute formatting for consistency.

Copy link
Contributor

coderabbitai bot commented Jan 1, 2025

Warning

Rate limit exceeded

@29deepanshutyagi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a6fc3a and 7e86760.

📒 Files selected for processing (4)
  • components/CaseStudyCard.tsx (1 hunks)
  • components/MDX/MDX.tsx (1 hunks)
  • components/sponsors/PlatinumSponsors.tsx (2 hunks)
  • pages/[lang]/index.tsx (1 hunks)

Walkthrough

The pull request introduces a new SponsorImage component in the sponsors section of the application. This component standardizes the rendering of sponsor logos across different sponsor tiers (Gold and Silver). The changes include replacing traditional <img> tags with the <SponsorImage> component in both the GoldSponsors and SilverSponsors components, enhancing consistency in image display while utilizing Tailwind CSS for styling.

Changes

File Change Summary
components/sponsors/SponsorImage.tsx New React component created to render sponsor logos with consistent styling and dimensions; includes props for src, alt, and className.
components/sponsors/GoldSponsors.tsx Replaced <img> with <SponsorImage> component, added new import for SponsorImage.
components/sponsors/SilverSponsors.tsx Replaced <img> with <SponsorImage> component, added new import for SponsorImage.

Sequence Diagram

sequenceDiagram
    participant Parent as Sponsors Component
    participant SponsorImage as SponsorImage Component
    Parent->>SponsorImage: Provide src, alt, className
    SponsorImage-->>Parent: Render centered logo
Loading

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

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

Poem

🐰 Hop, hop, a logo takes flight
In Tailwind's embrace, centered just right
From Silver to Gold, sponsors shine bright
A new component, pixel-perfect delight
CodeRabbit's magic, rendering with might! 🎨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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. (Beta)
  • @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 Jan 1, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7e86760
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/6788d0b7f6b04c00085211d0
😎 Deploy Preview https://deploy-preview-3534--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.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Jan 1, 2025

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 36
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3534--asyncapi-website.netlify.app/

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
components/sponsors/GoldSponsors.tsx (1)

3-3: Consider sorting imports as recommended by lint rules.

The linter warns about sorting imports. To adhere to project conventions and maintain a cleaner code structure, please consider applying the recommended sorting order.

🧰 Tools
🪛 eslint

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)

components/sponsors/SponsorImage.tsx (1)

13-26: Address ESLint/prettier formatting issues and trailing space warnings.
Some ESLint rules flag double quotes usage in JSX, trailing spaces, and missing a newline at the end of the file. You can fix them automatically using your project's lint or format command to keep code style consistent across the codebase.

Below is a sample diff to address potential format warnings (assuming single quotes are preferred in JSX and a newline is required at end of file):

     <div className="flex items-center justify-center w-full h-full">
-      <img
-        src={src}
-        alt={alt}
-        className={twMerge(
-          'max-h-9 sm:max-h-12 w-auto object-contain',
-          className
-        )}
-      />
+      <img
+        src={src}
+        alt={alt}
+        className={twMerge('max-h-9 sm:max-h-12 w-auto object-contain', className)}
+      />
     </div>
-}
\ No newline at end of file
+}
+
🧰 Tools
🪛 eslint

[error] 15-15: Replace "flex·items-center·justify-center·w-full·h-full" with 'flex·items-center·justify-center·w-full·h-full'

(prettier/prettier)


[error] 15-15: Unexpected usage of doublequote.

(jsx-quotes)


[error] 16-23: Replace ⏎········src={src}⏎········alt={alt}⏎········className={twMerge(⏎··········'max-h-9·sm:max-h-12·w-auto·object-contain',⏎··········className⏎········)}⏎····· with ·src={src}·alt={alt}·className={twMerge('max-h-9·sm:max-h-12·w-auto·object-contain',·className)}

(prettier/prettier)


[error] 26-26: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 26-26: Replace · with

(prettier/prettier)


[error] 26-26: Newline required at end of file but not found.

(eol-last)

components/sponsors/SilverSponsors.tsx (1)

3-3: Import statement is valid. Consider reordering imports to appease ESLint sorting rules.
If your project requires a particular import order, run your formatter or linter's autofix functionality to maintain consistency.

🧰 Tools
🪛 eslint

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb0a3bf and bf51e1d.

📒 Files selected for processing (3)
  • components/sponsors/GoldSponsors.tsx (2 hunks)
  • components/sponsors/SilverSponsors.tsx (2 hunks)
  • components/sponsors/SponsorImage.tsx (1 hunks)
🧰 Additional context used
🪛 eslint
components/sponsors/GoldSponsors.tsx

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)

components/sponsors/SilverSponsors.tsx

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)

components/sponsors/SponsorImage.tsx

[error] 15-15: Replace "flex·items-center·justify-center·w-full·h-full" with 'flex·items-center·justify-center·w-full·h-full'

(prettier/prettier)


[error] 15-15: Unexpected usage of doublequote.

(jsx-quotes)


[error] 16-23: Replace ⏎········src={src}⏎········alt={alt}⏎········className={twMerge(⏎··········'max-h-9·sm:max-h-12·w-auto·object-contain',⏎··········className⏎········)}⏎····· with ·src={src}·alt={alt}·className={twMerge('max-h-9·sm:max-h-12·w-auto·object-contain',·className)}

(prettier/prettier)


[error] 26-26: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 26-26: Replace · with

(prettier/prettier)


[error] 26-26: Newline required at end of file but not found.

(eol-last)

🔇 Additional comments (4)
components/sponsors/GoldSponsors.tsx (1)

29-35: New <SponsorImage> usage looks solid.

Wrapping images in a reusable component effectively standardizes styling and ensures consistent behavior across the application. No issues found.

components/sponsors/SponsorImage.tsx (2)

1-2: Imports look good, but consider following a consistent order.
The usage of React and twMerge is correct. In some projects, there's a preference to sort imports alphabetically or by import type. Adhering to a consistent sorting convention can improve readability.


4-8: Interface definitions appear clear and concise.
Declaring src as required and alt as optional is logical for sponsor images. The className prop is also neatly integrated for flexibility.

components/sponsors/SilverSponsors.tsx (1)

29-32: Great use of the new SponsorImage component!
The code neatly replaces the <img> tag, improving consistency for sponsor logos. Make sure to confirm that the alt and className values align with your team’s standards for accessibility and styling.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
components/sponsors/SilverSponsors.tsx (1)

Line range hint 6-9: Fix props interface inconsistency

The interface marks props as required but the implementation provides default values. Update the interface to match the implementation:

 interface SilverSponsorsProps {
-  className: string;
-  showSupportBanner: boolean;
+  className?: string;
+  showSupportBanner?: boolean;
 }
🧹 Nitpick comments (1)
components/sponsors/SponsorImage.tsx (1)

19-28: Consider performance optimizations for image loading

While the implementation correctly handles responsive design and aspect ratio, consider these performance improvements:

  1. Add loading="lazy" for better performance
  2. Consider using Next.js Image component for automatic optimization
 <div className="flex size-full items-center justify-center">
   <img
     src={src}
     alt={alt}
+    loading="lazy"
     className={twMerge(
       'max-h-9 sm:max-h-12 w-auto object-contain',
       className,
     )}
   />
 </div>
🧰 Tools
🪛 eslint

[error] 19-19: Replace "flex·size-full·items-center·justify-center" with 'flex·size-full·items-center·justify-center'

(prettier/prettier)


[error] 19-19: Unexpected usage of doublequote.

(jsx-quotes)


[error] 20-27: Replace ⏎········src={src}⏎········alt={alt}⏎········className={twMerge(⏎··········'max-h-9·sm:max-h-12·w-auto·object-contain',⏎··········className,⏎········)}⏎····· with ·src={src}·alt={alt}·className={twMerge('max-h-9·sm:max-h-12·w-auto·object-contain',·className)}

(prettier/prettier)


[error] 25-25: Unexpected trailing comma.

(comma-dangle)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bf51e1d and 16775b6.

📒 Files selected for processing (3)
  • components/sponsors/GoldSponsors.tsx (2 hunks)
  • components/sponsors/SilverSponsors.tsx (2 hunks)
  • components/sponsors/SponsorImage.tsx (1 hunks)
🧰 Additional context used
🪛 eslint
components/sponsors/GoldSponsors.tsx

[error] 17-19: Replace ⏎··className·=·'',⏎ with ·className·=·''·

(prettier/prettier)


[error] 18-18: Unexpected trailing comma.

(comma-dangle)


[error] 22-22: Replace "mb-8·flex·flex-wrap·items-center·justify-center·md:px-4" with 'mb-8·flex·flex-wrap·items-center·justify-center·md:px-4'

(prettier/prettier)


[error] 22-22: Unexpected usage of doublequote.

(jsx-quotes)


[error] 27-27: Replace "_blank" with '_blank'

(prettier/prettier)


[error] 27-27: Unexpected usage of doublequote.

(jsx-quotes)


[error] 28-28: Replace "relative·block·w-2/3·p-4·text-center·sm:w-1/2·sm:p-0·md:w-1/3·lg:w-1/5" with 'relative·block·w-2/3·p-4·text-center·sm:w-1/2·sm:p-0·md:w-1/3·lg:w-1/5'

(prettier/prettier)


[error] 28-28: Unexpected usage of doublequote.

(jsx-quotes)


[error] 29-29: Replace "noopener·noreferrer" with 'noopener·noreferrer'

(prettier/prettier)


[error] 29-29: Unexpected usage of doublequote.

(jsx-quotes)


[error] 30-30: Replace "GoldSponsors-link" with 'GoldSponsors-link'

(prettier/prettier)


[error] 30-30: Unexpected usage of doublequote.

(jsx-quotes)


[error] 36-36: Replace "GoldSponsors-img" with 'GoldSponsors-img'

(prettier/prettier)


[error] 36-36: Unexpected usage of doublequote.

(jsx-quotes)

components/sponsors/SilverSponsors.tsx

[error] 17-19: Replace ⏎··className·=·'',⏎ with ·className·=·''·

(prettier/prettier)


[error] 18-18: Unexpected trailing comma.

(comma-dangle)


[error] 22-22: Replace "mb-8·flex·flex-wrap·items-center·justify-center·md:px-4" with 'mb-8·flex·flex-wrap·items-center·justify-center·md:px-4'

(prettier/prettier)


[error] 22-22: Unexpected usage of doublequote.

(jsx-quotes)


[error] 27-27: Replace "_blank" with '_blank'

(prettier/prettier)


[error] 27-27: Unexpected usage of doublequote.

(jsx-quotes)


[error] 28-28: Replace "relative·block·w-2/3·p-4·text-center·sm:w-1/2·md:w-1/3·lg:w-1/4" with 'relative·block·w-2/3·p-4·text-center·sm:w-1/2·md:w-1/3·lg:w-1/4'

(prettier/prettier)


[error] 28-28: Unexpected usage of doublequote.

(jsx-quotes)


[error] 29-29: Replace "noopener·noreferrer" with 'noopener·noreferrer'

(prettier/prettier)


[error] 29-29: Unexpected usage of doublequote.

(jsx-quotes)


[error] 30-30: Replace "SilverSponsors-link" with 'SilverSponsors-link'

(prettier/prettier)


[error] 30-30: Unexpected usage of doublequote.

(jsx-quotes)


[error] 36-36: Replace "SilverSponsors-img" with 'SilverSponsors-img'

(prettier/prettier)


[error] 36-36: Unexpected usage of doublequote.

(jsx-quotes)

components/sponsors/SponsorImage.tsx

[error] 13-17: Replace ⏎··src,⏎··alt·=·'Sponsor·logo',⏎··className,⏎ with ·src,·alt·=·'Sponsor·logo',·className·

(prettier/prettier)


[error] 16-16: Unexpected trailing comma.

(comma-dangle)


[error] 19-19: Replace "flex·size-full·items-center·justify-center" with 'flex·size-full·items-center·justify-center'

(prettier/prettier)


[error] 19-19: Unexpected usage of doublequote.

(jsx-quotes)


[error] 20-27: Replace ⏎········src={src}⏎········alt={alt}⏎········className={twMerge(⏎··········'max-h-9·sm:max-h-12·w-auto·object-contain',⏎··········className,⏎········)}⏎····· with ·src={src}·alt={alt}·className={twMerge('max-h-9·sm:max-h-12·w-auto·object-contain',·className)}

(prettier/prettier)


[error] 25-25: Unexpected trailing comma.

(comma-dangle)

🔇 Additional comments (3)
components/sponsors/SponsorImage.tsx (1)

4-8: LGTM! Well-structured props interface.

The props interface is clear and properly typed with appropriate optional properties.

components/sponsors/GoldSponsors.tsx (1)

32-37: LGTM! Proper implementation of SponsorImage component

The integration maintains all necessary attributes including testing hooks while standardizing the image display.

🧰 Tools
🪛 eslint

[error] 36-36: Replace "GoldSponsors-img" with 'GoldSponsors-img'

(prettier/prettier)


[error] 36-36: Unexpected usage of doublequote.

(jsx-quotes)

components/sponsors/SilverSponsors.tsx (1)

32-37: LGTM! Consistent implementation with GoldSponsors

The SponsorImage integration matches the pattern used in GoldSponsors, maintaining consistency across sponsor tiers.

🧰 Tools
🪛 eslint

[error] 36-36: Replace "SilverSponsors-img" with 'SilverSponsors-img'

(prettier/prettier)


[error] 36-36: Unexpected usage of doublequote.

(jsx-quotes)

@29deepanshutyagi 29deepanshutyagi changed the title Fixes issue 3158: normalize the logos of sponsors Fix: normalize the logos of sponsors Jan 1, 2025
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (623f19f) to head (7e86760).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3534   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          668       668           
=========================================
  Hits           668       668           

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

@29deepanshutyagi 29deepanshutyagi changed the title Fix: normalize the logos of sponsors fix: normalize the logos of sponsors Jan 1, 2025
@29deepanshutyagi
Copy link
Author

29deepanshutyagi commented Jan 12, 2025

Screenshot from 2025-01-12 14-50-27

after commit

@29deepanshutyagi
Copy link
Author

29deepanshutyagi commented Jan 12, 2025

kindly review this pr , as no one had been go through it , since two weeks , @akshatnema and @derberg please review it,

@akshatnema
Copy link
Member

@devilkiller-ag Please review the PR once.

Copy link
Member

@devilkiller-ag devilkiller-ag left a comment

Choose a reason for hiding this comment

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

Changes looks GTM. @29deepanshutyagi Can you use the same SponsorImage class for Platinum Sponsors also for consistency?

@devilkiller-ag
Copy link
Member

@akshatnema, Currently the Platinum Sponsor related files are named Sponsors.tsx and SponsorsList.ts, and also their JSDoc comment is inconsistent. Should we rename these files?

@akshatnema
Copy link
Member

akshatnema commented Jan 14, 2025

@devilkiller-ag Yepp that makes sense.

@devilkiller-ag
Copy link
Member

devilkiller-ag commented Jan 14, 2025

@devilkiller-ag Yepp that makes sense.

@29deepanshutyagi Add Platinum to the names of Sponsors.tsx and SponsorsList.tsx files.

@29deepanshutyagi
Copy link
Author

Changes looks GTM. @29deepanshutyagi Can you use the same SponsorImage class for Platinum Sponsors also for consistency?

yeah sure, will soon commit the change

@29deepanshutyagi
Copy link
Author

29deepanshutyagi commented Jan 16, 2025

kindly check it @devilkiller-ag and @akshatnema ,

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.

4 participants