Skip to content

Commit

Permalink
added sort sponsors
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelgeek committed Oct 29, 2024
1 parent 9c48b16 commit ce78b1b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion components/home/SponsorsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 (
<section className="w-full dark:bg-black">
<div className="s-container">
Expand Down Expand Up @@ -123,7 +141,7 @@ function SponsorsList({

{showSponsors && (
<div className="grid grid-cols-2 md:grid-cols-3 border-t">
{sponsors
{sortedSponsors
.filter((s) => s.sponsor_type !== 'platinum')
.map((sponsor) => (
<div
Expand Down

0 comments on commit ce78b1b

Please sign in to comment.