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
5 changes: 3 additions & 2 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 SponsorImage from './SponsorImage';

interface GoldSponsorsProps {
className?: string;
Expand All @@ -26,10 +27,10 @@ export default function GoldSponsors({ className = '' }: GoldSponsorsProps): Rea
rel='noopener noreferrer'
data-testid='GoldSponsors-link'
>
<img
className={sponsor.imageClass}
<SponsorImage
src={sponsor.imageSrc}
alt={sponsor.altText}
className={sponsor.imageClass}
data-testid='GoldSponsors-img'
/>
</a>
Expand Down
5 changes: 3 additions & 2 deletions components/sponsors/SilverSponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Silversponsors } from './SilverSponsorsList';
import SponsorImage from './SponsorImage';

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

interface SponsorImageProps {
src: string;
alt?: string;
className?: string;
}

/**
* A component that displays sponsor logos with consistent dimensions
*/
export default function SponsorImage({ src, alt = 'Sponsor logo', className }: SponsorImageProps) {
return (
<div className='flex size-full items-center justify-center'>
<img src={src} alt={alt} className={twMerge('max-h-9 sm:max-h-12 w-auto object-contain', className)} />
</div>
);
}
Loading