Skip to content

Commit ce78b1b

Browse files
committed
added sort sponsors
1 parent 9c48b16 commit ce78b1b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

components/home/SponsorsList.tsx

+19-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function SponsorsList({
2626

2727
const getImageClass = useCallback(
2828
(sponsor: Sponsor) => {
29+
if (sponsor.name.includes('Flutter Dev')) return 'max-h-[56px]'
2930
if (sponsor.name.includes('JetBrains')) return 'max-h-20'
3031
if (sponsor.name.includes('Composables')) return 'max-h-[48px]'
3132
if (sponsor.name.includes('JumaAndMiles')) return 'max-h-24'
@@ -52,6 +53,23 @@ function SponsorsList({
5253
[isDarkTheme]
5354
)
5455

56+
const givenOrder: string[] = [
57+
'platinum',
58+
'gold',
59+
'silver',
60+
'bronze',
61+
'startup',
62+
'swag',
63+
'venue',
64+
]
65+
66+
const sortedSponsors = sponsors.sort((a, b) => {
67+
return (
68+
givenOrder.indexOf(givenOrder.find((g) => a.sponsor_type === g) || '') -
69+
givenOrder.indexOf(givenOrder.find((g) => b.sponsor_type === g) || '')
70+
)
71+
})
72+
5573
return (
5674
<section className="w-full dark:bg-black">
5775
<div className="s-container">
@@ -123,7 +141,7 @@ function SponsorsList({
123141

124142
{showSponsors && (
125143
<div className="grid grid-cols-2 md:grid-cols-3 border-t">
126-
{sponsors
144+
{sortedSponsors
127145
.filter((s) => s.sponsor_type !== 'platinum')
128146
.map((sponsor) => (
129147
<div

0 commit comments

Comments
 (0)