Skip to content

Commit a12e9dc

Browse files
committed
simplify sponsor cards
1 parent 43916f4 commit a12e9dc

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

packages/frontendmu-nuxt/components/home/SponsorCarousel.vue

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ const sortedSponsors = computed(() => {
1717
})
1818
})
1919
20+
function opacityValue(index: number) {
21+
// the lower the index, the closer it has to be to 100, the higher the index it has to reach 0
22+
// the max index is sortedSponsors.length - 1
23+
const maxIndex = sortedSponsors.value.length - 1
24+
return Math.floor(100 - (index * 100) / maxIndex)
25+
}
26+
2027
function sponsorLogoUrl(sponsor: any) {
2128
if (typeof sponsor.logo === 'string') {
2229
return `https://directus.frontend.mu/assets/${sponsor.logo}`
@@ -28,7 +35,7 @@ const carouselRef = templateRef<HTMLDivElement>('carouselRef')
2835
</script>
2936

3037
<template>
31-
<section class="relative w-full bg-white/50 dark:bg-verse-200/5 backdrop-blur-sm mx-auto py-6 md:py-10">
38+
<section class="relative w-full dark:bg-verse-200/5 backdrop-blur-sm mx-auto py-6 md:py-10">
3239
<div class="flex items-center justify-center mb-3 w-full">
3340
<h2 class="font-heading tracking-tight text-verse-900 dark:text-verse-200 font-light text-3xl sm:text-4xl md:text-5xl">
3441
Sponsored by
@@ -37,22 +44,34 @@ const carouselRef = templateRef<HTMLDivElement>('carouselRef')
3744
<div class="w-full py-4 px-8 max-w-7xl mx-auto">
3845
<div
3946
ref="carouselRef"
40-
class="grid grid-cols-6 gap-4 overflow-x-auto"
47+
class="grid lg:grid-cols-4 md:grid-cols-2 grid-cols-1 gap-8"
4148
tabindex="0"
4249
aria-label="Sponsor logos carousel"
4350
>
4451
<div
45-
v-for="sponsor in sortedSponsors"
52+
v-for="(sponsor) in sortedSponsors"
4653
:key="sponsor.id"
47-
class="flex justify-center items-center bg-white p-4 rounded-md"
54+
class="grid place-items-center justify-center items-center bg-white p-4 rounded-md"
4855
:title="sponsor.name"
4956
>
50-
<img
51-
:src="sponsorLogoUrl(sponsor)"
52-
:alt="sponsor.name"
53-
:class="sponsor.darkbg ? 'dark:bg-verse-900 bg-gray-500' : ''"
54-
draggable="false"
57+
<!-- :style="{ opacity: `${opacityValue(index)}%`, width: `${opacityValue(index) / 6}%`, filter: `saturate(${opacityValue(index) / 100})` }" -->
58+
<NuxtLink
59+
:to="{
60+
name: 'meetup-id',
61+
params: {
62+
id: sponsor.meetups[0].id,
63+
},
64+
}"
65+
:title="`${sponsor.name} has sponsored the ${sponsor.meetups[0].title} meetup at ${sponsor.meetups[0].venue}`"
5566
>
67+
<img
68+
:src="sponsorLogoUrl(sponsor)"
69+
:alt="sponsor.name"
70+
:class="sponsor.darkbg ? 'dark:bg-verse-900 bg-gray-500' : ''"
71+
class="h-20 max-h-24 w-full object-contain rounded-md p-2"
72+
draggable="false"
73+
>
74+
</NuxtLink>
5675
</div>
5776
</div>
5877
</div>

0 commit comments

Comments
 (0)