Skip to content

Commit 57b04ed

Browse files
committed
added sort sponsors
1 parent 0e48893 commit 57b04ed

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

components/home/SponsorsList.tsx

+18-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ function SponsorsList({
5252
[isDarkTheme]
5353
)
5454

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

123140
{showSponsors && (
124141
<div className="grid grid-cols-2 md:grid-cols-3 border-t">
125-
{sponsors
142+
{sortedSponsors
126143
.filter((s) => s.sponsor_type !== 'platinum')
127144
.map((sponsor) => (
128145
<div

0 commit comments

Comments
 (0)