Skip to content

Commit 43916f4

Browse files
committed
rework sponsor layout
1 parent a51f92b commit 43916f4

File tree

1 file changed

+7
-164
lines changed

1 file changed

+7
-164
lines changed

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

Lines changed: 7 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { templateRef } from '@vueuse/core'
33
import { useSponsorStore } from '@/store/sponsorStore'
44
55
const sponsorStore = useSponsorStore()
6-
// Get all sponsors, sorted by their most recent event date descending
6+
// Get all sponsors, sorted by their most recent event date descending and remove duplicate sponsors from the list
77
const sortedSponsors = computed(() => {
88
return [...sponsorStore.sponsors]
99
.sort((a, b) => {
@@ -12,6 +12,9 @@ const sortedSponsors = computed(() => {
1212
const bLatest = b.meetups.reduce((max, m) => m.date > max ? m.date : max, '')
1313
return bLatest.localeCompare(aLatest)
1414
})
15+
.filter((sponsor, index, self) => {
16+
return index === self.findIndex(s => s.name.toLowerCase() === sponsor.name.toLowerCase())
17+
})
1518
})
1619
1720
function sponsorLogoUrl(sponsor: any) {
@@ -31,23 +34,22 @@ const carouselRef = templateRef<HTMLDivElement>('carouselRef')
3134
Sponsored by
3235
</h2>
3336
</div>
34-
<div class="w-full py-4">
37+
<div class="w-full py-4 px-8 max-w-7xl mx-auto">
3538
<div
3639
ref="carouselRef"
37-
class="carousel-grid"
40+
class="grid grid-cols-6 gap-4 overflow-x-auto"
3841
tabindex="0"
3942
aria-label="Sponsor logos carousel"
4043
>
4144
<div
4245
v-for="sponsor in sortedSponsors"
4346
:key="sponsor.id"
44-
class="carousel-item"
47+
class="flex justify-center items-center bg-white p-4 rounded-md"
4548
:title="sponsor.name"
4649
>
4750
<img
4851
:src="sponsorLogoUrl(sponsor)"
4952
:alt="sponsor.name"
50-
class="carousel-img"
5153
:class="sponsor.darkbg ? 'dark:bg-verse-900 bg-gray-500' : ''"
5254
draggable="false"
5355
>
@@ -61,162 +63,3 @@ const carouselRef = templateRef<HTMLDivElement>('carouselRef')
6163
</div>
6264
</section>
6365
</template>
64-
65-
<style scoped>
66-
@keyframes rotate {
67-
from {
68-
transform: rotate(0deg);
69-
}
70-
to {
71-
transform: rotate(360deg);
72-
}
73-
}
74-
75-
@keyframes slide {
76-
from {
77-
/* transform: translateX(0); */
78-
margin-left:0;
79-
}
80-
to {
81-
/* transform: translateX(-10%); */
82-
margin-left: -500px;
83-
}
84-
}
85-
86-
.carousel-grid {
87-
/* animation: slide linear both;
88-
animation-timeline: view(block);
89-
animation-range: cover 0% cover 100%; */
90-
91-
position: relative;
92-
display: grid;
93-
grid-auto-flow: column;
94-
grid-template-rows: repeat(4, 1fr);
95-
gap: 1rem;
96-
overflow-x: auto;
97-
width: 100%;
98-
scroll-snap-type: x mandatory;
99-
scroll-padding-left: 1rem;
100-
scroll-padding-right: 1rem;
101-
padding-bottom: 1rem;
102-
padding-left: 1rem;
103-
padding-right: 1rem;
104-
scrollbar-width: thin;
105-
}
106-
107-
.carousel-item {
108-
scroll-snap-align: center;
109-
display: flex;
110-
align-items: center;
111-
justify-content: center;
112-
background: var(--tw-prose-bg, white);
113-
border-radius: 0.5rem;
114-
transition: transform 0.3s cubic-bezier(.4,2,.6,1);
115-
width: 10rem;
116-
height: 6rem;
117-
}
118-
119-
.carousel-item:active {
120-
transform: scale(0.96);
121-
}
122-
123-
.carousel-img {
124-
width: 100%;
125-
height: 100%;
126-
object-fit: contain;
127-
border-radius: 0.25rem;
128-
padding: 1rem;
129-
filter: saturate(0);
130-
transition: filter 0.3s;
131-
}
132-
.carousel-img:hover {
133-
filter: saturate(1);
134-
}
135-
136-
@media (max-width: 768px) {
137-
.carousel-grid {
138-
grid-template-rows: repeat(2, 1fr);
139-
gap: 0.5rem;
140-
}
141-
.carousel-item {
142-
width: 7rem;
143-
height: 4rem;
144-
}
145-
}
146-
147-
@media (max-width: 480px) {
148-
.carousel-grid {
149-
grid-template-rows: repeat(2, 1fr);
150-
gap: 0.25rem;
151-
}
152-
.carousel-item {
153-
width: 5.5rem;
154-
height: 3rem;
155-
}
156-
}
157-
.carousel::-webkit-scrollbar {
158-
height: 12px;
159-
background: transparent;
160-
}
161-
.light-mode .carousel::-webkit-scrollbar-thumb {
162-
background: linear-gradient(90deg, #b6c2de 0%, #e0e7ef 100%);
163-
border-radius: 8px;
164-
border: 2px solid #f0f4fa;
165-
background-clip: padding-box;
166-
box-shadow: 0 2px 8px #cbd5e188;
167-
opacity: 0.7;
168-
transition: background 0.2s, opacity 0.3s;
169-
}
170-
.light-mode .carousel::-webkit-scrollbar-thumb:hover,
171-
.light-mode .carousel::-webkit-scrollbar-thumb:active {
172-
background: linear-gradient(90deg, #e0e7ef 0%, #b6c2de 100%);
173-
opacity: 1;
174-
}
175-
.light-mode .carousel::-webkit-scrollbar-track {
176-
background: #f8fafc;
177-
border-radius: 8px;
178-
}
179-
180-
.dark-mode .carousel::-webkit-scrollbar-thumb {
181-
background: linear-gradient(90deg, #7dd3fc 0%, #94a3b8 100%);
182-
border-radius: 8px;
183-
border: 3px solid #1e293b;
184-
background-clip: padding-box;
185-
box-shadow: 0 2px 8px #0f172a88;
186-
opacity: 0.7;
187-
transition: background 0.2s, opacity 0.3s;
188-
}
189-
.dark-mode .carousel::-webkit-scrollbar-thumb:hover,
190-
.dark-mode .carousel::-webkit-scrollbar-thumb:active {
191-
background: linear-gradient(90deg, #bae6fd 0%, #a5b4fc 100%);
192-
opacity: 1;
193-
}
194-
.dark-mode .carousel::-webkit-scrollbar-track {
195-
background: rgba(15, 23, 42, 0.3);
196-
border-radius: 8px;
197-
}
198-
199-
.carousel {
200-
scrollbar-width: thin;
201-
}
202-
.light-mode .carousel {
203-
scrollbar-color: #b6c2de #f8fafc;
204-
}
205-
.dark-mode .carousel {
206-
scrollbar-color: #7dd3fc #23293a;
207-
}
208-
209-
.carousel-arrow {
210-
@apply flex items-center justify-center p-2 rounded-full bg-verse-100 dark:bg-verse-800 hover:bg-verse-200 dark:hover:bg-verse-700 shadow transition;
211-
outline: none;
212-
}
213-
.carousel-arrow:focus {
214-
@apply ring-2 ring-verse-400;
215-
}
216-
.carousel-item {
217-
transition: transform 0.3s cubic-bezier(.4,2,.6,1);
218-
}
219-
.carousel-item:active {
220-
transform: scale(0.96);
221-
}
222-
</style>

0 commit comments

Comments
 (0)