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: normalized logos of sponsors #3169

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions components/sponsors/GoldSponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { goldSponsors } from './GoldSponsorsList';
import ResponsiveImage from './ResponsiveImage';

interface GoldSponsorsProps {
className?: string;
Expand All @@ -26,11 +27,11 @@ export default function GoldSponsors({ className = '' }: GoldSponsorsProps): Rea
rel='noopener noreferrer'
data-testid='GoldSponsors-link'
>
<img
className={sponsor.imageClass}
<ResponsiveImage
src={sponsor.imageSrc}
alt={sponsor.altText}
data-testid='GoldSponsors-img'
className={sponsor.imageClass}
dataTestId='GoldSponsors-img'
/>
</a>
))}
Expand Down
37 changes: 37 additions & 0 deletions components/sponsors/ResponsiveImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { twMerge } from 'tailwind-merge';

interface ResponsiveImageProps {
src: string;
alt: string;
className?: string;
dataTestId: string;
}

/*
* This component displays the responsive image of the sponsors.
* @param {ResponsiveImageProps} props - The props for ResponsiveImage component.
* @param {string} props.src - Source of the image displayed.
* @param {string} props.alt - Alternative text for the image, important for accessibility.
* @param {string} props.className - Additional CSS class names for styling the image.
* @param {string} props.dataTestId - A string for identifying the element during testing.
*/
const ResponsiveImage: React.FC<ResponsiveImageProps> = ({
src,
alt,
className,
dataTestId,
}) => {
const classNameMerged = twMerge('w-full h-12 object-contain', className);

return (
<img
src={src}
alt={alt}
className={`${classNameMerged}`}
data-testid={dataTestId}
/>
);
};

export default ResponsiveImage;
8 changes: 4 additions & 4 deletions components/sponsors/SilverSponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ResponsiveImage from './ResponsiveImage';
import React from 'react';

import { Silversponsors } from './SilverSponsorsList';

interface SilverSponsorsProps {
Expand All @@ -26,11 +26,11 @@ export default function SilverSponsors({ className = '' }: SilverSponsorsProps):
rel='noopener noreferrer'
data-testid='SilverSponsors-link'
>
<img
className={sponsor.imageClass}
<ResponsiveImage
src={sponsor.imageSrc}
alt={sponsor.altText}
data-testid='SilverSponsors-img'
className={sponsor.imageClass}
dataTestId='SilverSponsors-img'
/>
</a>
))}
Expand Down
8 changes: 4 additions & 4 deletions components/sponsors/Sponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ResponsiveImage from './ResponsiveImage';
import React from 'react';

import { sponsors } from './SponsorsList';

interface SponsorsProps {
Expand All @@ -26,11 +26,11 @@ export default function Sponsors({ className = '', showSupportBanner = true }: S
rel='noopener noreferrer'
data-testid='Sponsors-link'
>
<img
className={sponsor?.imageClass}
<ResponsiveImage
src={sponsor.imageSrc}
alt={sponsor.altText}
data-testid='Sponsors-img'
className={sponsor?.imageClass}
dataTestId='Sponsors-img'
/>
</a>
</li>
Expand Down
Loading