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

Merged
merged 13 commits into from
Jan 27, 2025
Merged
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
4 changes: 2 additions & 2 deletions components/CaseStudyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default function CaseStudyCard({ studies = [] }: ICaseStudyCardProps) {
}

return (
<div className='flex flex-wrap pt-10 lg:grid lg:grid-cols-3 lg:gap-8 lg:text-center gap-3'>
<div className='flex flex-wrap gap-3 pt-10 lg:grid lg:grid-cols-3 lg:gap-8 lg:text-center'>
{studies.map((study, index) => (
<a key={index} href={`casestudies/${study.id}`}>
<div
className='max-w-sm h-full overflow-hidden min-h-[300px] rounded-md border border-gray-200 bg-white p-4'
className='h-full min-h-[300px] max-w-sm overflow-hidden rounded-md border border-gray-200 bg-white p-4'
data-testid='CaseStudyCard-main'
>
<span className='mr-2'>
Expand Down
2 changes: 1 addition & 1 deletion components/MDX/MDX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import Row from '../layout/Row';
import NewsletterSubscribe from '../NewsletterSubscribe';
import Profiles from '../Profiles';
import Remember from '../Remember';
import Sponsors from '../sponsors/Sponsors';
import Sponsors from '../sponsors/PlatinumSponsors';
import Warning from '../Warning';
import { Table, TableBody, TableCell, TableHeader, TableRow, Thead } from './MDXTable';

Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { sponsors } from './SponsorsList';
import { platinumSponsors } from './PlatinumSponsorsList';
import SponsorImage from './SponsorImage';

interface SponsorsProps {
className: string;
Expand All @@ -13,11 +14,11 @@ interface SponsorsProps {
* @param {string} props.className - Additional CSS classes for styling.
* @param {boolean} props.showSupportBanner - Indicates whether support banner should be displayed.
*/
export default function Sponsors({ className = '', showSupportBanner = true }: SponsorsProps): React.ReactNode {
export default function PlatinumSponsors({ className = '', showSupportBanner = true }: SponsorsProps): React.ReactNode {
return (
<div className={`text-center ${className}`}>
<ul className='mb-4 flex flex-wrap items-center justify-center md:px-4'>
{sponsors.map((sponsor, index) => (
{platinumSponsors.map((sponsor, index) => (
<li key={index} className='w-2/3 sm:w-1/4 md:w-1/3 lg:w-1/5' data-testid='Sponsors-list'>
<a
href={sponsor.website}
Expand All @@ -26,7 +27,7 @@ export default function Sponsors({ className = '', showSupportBanner = true }: S
rel='noopener noreferrer'
data-testid='Sponsors-link'
>
<img
<SponsorImage
className={sponsor?.imageClass}
src={sponsor.imageSrc}
alt={sponsor.altText}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SponsorType } from '@/types/components/sponsors/SponsorType';

export const sponsors: SponsorType[] = [
export const platinumSponsors: SponsorType[] = [
{
name: 'Solace',
website: 'https://www.solace.com',
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>
);
}
4 changes: 2 additions & 2 deletions pages/[lang]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import NewsletterSubscribe from '../../components/NewsletterSubscribe';
import NewsroomSection from '../../components/newsroom/NewsroomSection';
import Slack from '../../components/slack';
import GoldSponsors from '../../components/sponsors/GoldSponsors';
import PlatinumSponsors from '../../components/sponsors/PlatinumSponsors';
import SilverSponsors from '../../components/sponsors/SilverSponsors';
import Sponsors from '../../components/sponsors/Sponsors';
import SupportUs from '../../components/SupportUs/SupportUs';
import Testimonial from '../../components/Testimonial';
import Heading from '../../components/typography/Heading';
Expand Down Expand Up @@ -149,7 +149,7 @@ export default function HomePage() {
<Heading level={HeadingLevel.h3} typeStyle={HeadingTypeStyle.lg} className='mb-4'>
{t('sponsors.platinumTitle')}
</Heading>
<Sponsors className='mt-4' showSupportBanner={false} />
<PlatinumSponsors className='mt-4' showSupportBanner={false} />
</Container>

<Container className='pb-6 text-center' wide as='section'>
Expand Down
Loading