From ce78b1bd678898507ff32eea4dd384c5606a9416 Mon Sep 17 00:00:00 2001 From: Magak Emmanuel Date: Wed, 30 Oct 2024 00:41:14 +0300 Subject: [PATCH] added sort sponsors --- components/home/SponsorsList.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/components/home/SponsorsList.tsx b/components/home/SponsorsList.tsx index 098b158..5ad4c54 100644 --- a/components/home/SponsorsList.tsx +++ b/components/home/SponsorsList.tsx @@ -26,6 +26,7 @@ function SponsorsList({ const getImageClass = useCallback( (sponsor: Sponsor) => { + if (sponsor.name.includes('Flutter Dev')) return 'max-h-[56px]' if (sponsor.name.includes('JetBrains')) return 'max-h-20' if (sponsor.name.includes('Composables')) return 'max-h-[48px]' if (sponsor.name.includes('JumaAndMiles')) return 'max-h-24' @@ -52,6 +53,23 @@ function SponsorsList({ [isDarkTheme] ) + const givenOrder: string[] = [ + 'platinum', + 'gold', + 'silver', + 'bronze', + 'startup', + 'swag', + 'venue', + ] + + const sortedSponsors = sponsors.sort((a, b) => { + return ( + givenOrder.indexOf(givenOrder.find((g) => a.sponsor_type === g) || '') - + givenOrder.indexOf(givenOrder.find((g) => b.sponsor_type === g) || '') + ) + }) + return (
@@ -123,7 +141,7 @@ function SponsorsList({ {showSponsors && (
- {sponsors + {sortedSponsors .filter((s) => s.sponsor_type !== 'platinum') .map((sponsor) => (