|
| 1 | +'use client'; |
| 2 | + |
| 3 | +import Image from 'next/image'; |
| 4 | +import Link from 'next/link'; |
| 5 | +import type { Sponsor } from './sponsors-data'; |
| 6 | + |
| 7 | +interface SponsorsGridProps { |
| 8 | + sponsors: Sponsor[]; |
| 9 | +} |
| 10 | + |
| 11 | +function SponsorCard({ sponsor }: { sponsor: Sponsor }) { |
| 12 | + const tierColors = { |
| 13 | + platinum: 'border-purple-500/30 bg-purple-500/5', |
| 14 | + gold: 'border-yellow-500/30 bg-yellow-500/5', |
| 15 | + silver: 'border-gray-400/30 bg-gray-400/5', |
| 16 | + bronze: 'border-orange-600/30 bg-orange-600/5', |
| 17 | + }; |
| 18 | + |
| 19 | + const tierLabels = { |
| 20 | + platinum: 'Platinum', |
| 21 | + gold: 'Gold', |
| 22 | + silver: 'Silver', |
| 23 | + bronze: 'Bronze', |
| 24 | + }; |
| 25 | + |
| 26 | + return ( |
| 27 | + <Link |
| 28 | + className="group block" |
| 29 | + href={sponsor.website} |
| 30 | + rel="noopener noreferrer" |
| 31 | + target="_blank" |
| 32 | + > |
| 33 | + <div |
| 34 | + className={`relative h-full rounded border backdrop-blur-sm transition-all duration-300 hover:border-border/80 hover:bg-card/70 hover:shadow-lg ${tierColors[sponsor.tier]}`} |
| 35 | + > |
| 36 | + <div className="flex flex-col items-center p-8"> |
| 37 | + {/* Tier Badge */} |
| 38 | + <div className="mb-4 rounded-full bg-primary/10 px-3 py-1 font-medium text-primary text-xs"> |
| 39 | + {tierLabels[sponsor.tier]} Sponsor |
| 40 | + </div> |
| 41 | + |
| 42 | + {/* Logo */} |
| 43 | + <div className="mb-6 flex h-24 w-full items-center justify-center"> |
| 44 | + <Image |
| 45 | + alt={`${sponsor.name} logo`} |
| 46 | + className="max-h-full max-w-full object-contain transition-transform duration-300 group-hover:scale-105" |
| 47 | + height={96} |
| 48 | + src={sponsor.logo} |
| 49 | + width={200} |
| 50 | + /> |
| 51 | + </div> |
| 52 | + |
| 53 | + {/* Name */} |
| 54 | + <h3 className="mb-2 text-center font-semibold text-foreground text-xl transition-colors group-hover:text-primary"> |
| 55 | + {sponsor.name} |
| 56 | + </h3> |
| 57 | + |
| 58 | + {/* Description */} |
| 59 | + {sponsor.description && ( |
| 60 | + <p className="text-center text-muted-foreground text-sm leading-relaxed"> |
| 61 | + {sponsor.description} |
| 62 | + </p> |
| 63 | + )} |
| 64 | + </div> |
| 65 | + |
| 66 | + {/* Sci-fi corners */} |
| 67 | + <div className="pointer-events-none absolute inset-0"> |
| 68 | + <div className="absolute top-0 left-0 h-2 w-2 group-hover:animate-[cornerGlitch_0.6s_ease-in-out]"> |
| 69 | + <div className="absolute top-0 left-0.5 h-0.5 w-1.5 origin-left bg-foreground" /> |
| 70 | + <div className="absolute top-0 left-0 h-2 w-0.5 origin-top bg-foreground" /> |
| 71 | + </div> |
| 72 | + <div className="-scale-x-[1] absolute top-0 right-0 h-2 w-2 group-hover:animate-[cornerGlitch_0.6s_ease-in-out]"> |
| 73 | + <div className="absolute top-0 left-0.5 h-0.5 w-1.5 origin-left bg-foreground" /> |
| 74 | + <div className="absolute top-0 left-0 h-2 w-0.5 origin-top bg-foreground" /> |
| 75 | + </div> |
| 76 | + <div className="-scale-y-[1] absolute bottom-0 left-0 h-2 w-2 group-hover:animate-[cornerGlitch_0.6s_ease-in-out]"> |
| 77 | + <div className="absolute top-0 left-0.5 h-0.5 w-1.5 origin-left bg-foreground" /> |
| 78 | + <div className="absolute top-0 left-0 h-2 w-0.5 origin-top bg-foreground" /> |
| 79 | + </div> |
| 80 | + <div className="-scale-[1] absolute right-0 bottom-0 h-2 w-2 group-hover:animate-[cornerGlitch_0.6s_ease-in-out]"> |
| 81 | + <div className="absolute top-0 left-0.5 h-0.5 w-1.5 origin-left bg-foreground" /> |
| 82 | + <div className="absolute top-0 left-0 h-2 w-0.5 origin-top bg-foreground" /> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | + </Link> |
| 87 | + ); |
| 88 | +} |
| 89 | + |
| 90 | +export default function SponsorsGrid({ sponsors }: SponsorsGridProps) { |
| 91 | + if (sponsors.length === 0) { |
| 92 | + return ( |
| 93 | + <div className="text-center"> |
| 94 | + <h2 className="mb-4 font-semibold text-2xl">Our Sponsors</h2> |
| 95 | + <p className="text-muted-foreground"> |
| 96 | + No sponsors to display at the moment |
| 97 | + </p> |
| 98 | + </div> |
| 99 | + ); |
| 100 | + } |
| 101 | + |
| 102 | + const sponsorsByTier = sponsors.reduce( |
| 103 | + (acc, sponsor) => { |
| 104 | + if (!acc[sponsor.tier]) { |
| 105 | + if (sponsor.disabled) { |
| 106 | + return acc; |
| 107 | + } |
| 108 | + acc[sponsor.tier] = []; |
| 109 | + } |
| 110 | + acc[sponsor.tier].push(sponsor); |
| 111 | + return acc; |
| 112 | + }, |
| 113 | + {} as Record<string, Sponsor[]> |
| 114 | + ); |
| 115 | + |
| 116 | + const tierOrder: Array<keyof typeof sponsorsByTier> = [ |
| 117 | + 'platinum', |
| 118 | + 'gold', |
| 119 | + 'silver', |
| 120 | + 'bronze', |
| 121 | + ]; |
| 122 | + |
| 123 | + return ( |
| 124 | + <div> |
| 125 | + {/* Header */} |
| 126 | + <div className="mb-12 text-center"> |
| 127 | + <h2 className="mb-4 font-semibold text-2xl sm:text-3xl lg:text-4xl"> |
| 128 | + Our Sponsors |
| 129 | + </h2> |
| 130 | + <p className="mx-auto max-w-2xl text-muted-foreground text-sm sm:text-base lg:text-lg"> |
| 131 | + Thank you to these amazing companies and individuals for supporting |
| 132 | + our mission |
| 133 | + </p> |
| 134 | + </div> |
| 135 | + |
| 136 | + {/* Sponsors by Tier */} |
| 137 | + <div className="space-y-16"> |
| 138 | + {tierOrder.map((tier) => { |
| 139 | + const tierSponsors = sponsorsByTier[tier]; |
| 140 | + if (!tierSponsors || tierSponsors.length === 0) { |
| 141 | + return null; |
| 142 | + } |
| 143 | + |
| 144 | + const tierLabels = { |
| 145 | + platinum: 'Platinum Sponsors', |
| 146 | + gold: 'Gold Sponsors', |
| 147 | + silver: 'Silver Sponsors', |
| 148 | + bronze: 'Bronze Sponsors', |
| 149 | + }; |
| 150 | + |
| 151 | + const gridCols = { |
| 152 | + platinum: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-2', |
| 153 | + gold: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3', |
| 154 | + silver: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| 155 | + bronze: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| 156 | + }; |
| 157 | + |
| 158 | + return ( |
| 159 | + <div key={tier}> |
| 160 | + <h3 className="mb-8 text-center font-semibold text-xl sm:text-2xl"> |
| 161 | + {tierLabels[tier]} |
| 162 | + </h3> |
| 163 | + <div className={`grid gap-6 ${gridCols[tier]}`}> |
| 164 | + {tierSponsors.map((sponsor) => ( |
| 165 | + <SponsorCard key={sponsor.id} sponsor={sponsor} /> |
| 166 | + ))} |
| 167 | + </div> |
| 168 | + </div> |
| 169 | + ); |
| 170 | + })} |
| 171 | + </div> |
| 172 | + </div> |
| 173 | + ); |
| 174 | +} |
0 commit comments