Skip to content

Commit e170b55

Browse files
committed
List current sponsors on the home page, sized by tier
1 parent 72cca8e commit e170b55

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

src/components/Home/Sponsors.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import { useSponsors } from "@/hooks/useSponsors";
12
import { useTranslation } from "@/hooks/useTranslation";
3+
import { Sponsor } from "@/type/sponsors";
24
import { motion } from "framer-motion";
35
import { Link } from "react-router-dom";
46

57
function Sponsors() {
68
const { t } = useTranslation();
9+
const { orSponsors, argentSponsors, bronzeSponsors, supporterSponsors } =
10+
useSponsors();
711

812
return (
913
<div className="bg-gradient-to-b from-primary-dark to-primary/80">
@@ -24,6 +28,14 @@ function Sponsors() {
2428
</h3>
2529
<div className="w-16 h-1 bg-white mx-auto mb-6"></div>
2630
</motion.div>
31+
32+
<div className="flex flex-col gap-6 mb-12">
33+
<SponsorTier sponsors={orSponsors} size="size-52" />
34+
<SponsorTier sponsors={argentSponsors} size="size-44" />
35+
<SponsorTier sponsors={bronzeSponsors} size="size-36" />
36+
<SponsorTier sponsors={supporterSponsors} size="size-36" />
37+
</div>
38+
2739
<h3 className="text-3xl font-semibold text-white mb-6 text-center">
2840
{t({
2941
fr: "Soutenez la communauté tech montréalaise",
@@ -56,3 +68,42 @@ function Sponsors() {
5668
}
5769

5870
export default Sponsors;
71+
72+
function SponsorTier({ sponsors, size }: { sponsors: Sponsor[]; size: string }) {
73+
if (sponsors.length === 0) {
74+
return null;
75+
}
76+
77+
return (
78+
<motion.div
79+
initial="hidden"
80+
whileInView="visible"
81+
viewport={{ once: true }}
82+
className="flex flex-wrap gap-8 justify-center items-end"
83+
>
84+
{sponsors.map((sponsor) => (
85+
<motion.div
86+
key={sponsor.name}
87+
variants={{
88+
hidden: { opacity: 0, y: 50 },
89+
visible: { opacity: 1, y: 0 },
90+
}}
91+
transition={{ duration: 0.6, ease: "easeOut" }}
92+
>
93+
<a
94+
href={sponsor.url}
95+
target="_blank"
96+
rel="noopener noreferrer"
97+
className="group"
98+
>
99+
<img
100+
src={`${import.meta.env.BASE_URL}${sponsor.logo}`}
101+
alt={sponsor.name}
102+
className={`${size} object-contain bg-white p-4 transition duration-300 group-hover:scale-110`}
103+
/>
104+
</a>
105+
</motion.div>
106+
))}
107+
</motion.div>
108+
);
109+
}

0 commit comments

Comments
 (0)