Skip to content

Commit d625a62

Browse files
authored
Merge pull request #161 from the-code-raider/main
#160 Fixed active featured speaker
2 parents ea4dfe8 + d1d9d01 commit d625a62

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@
88
<ul id="team" role="list" class="mx-auto flex flex-wrap md:flex-nowrap justify-center gap-4">
99
<li
1010
v-for="(person, index) in featuredSpeakers" :key="person.id" :class="[
11-
'single-photo rounded-xl overflow-hidden relative group',
11+
'single-photo rounded-xl overflow-hidden relative group cursor-pointer',
1212
'index-' + index,
13-
isCenter(index, featuredSpeakers.length) && 'active',
14-
]">
13+
activeSpeakerId === person.id && 'active',
14+
]"
15+
@click="activeSpeakerId = person.id">
1516
<img
16-
class="mx-auto md:saturate-0 rounded-xl ease-in-out duration-300 md:h-[640px] h-[150px] w-[150px] md:w-[90px] object-cover object-center md:group-hover:w-[120px] group-hover:saturate-100 transition-all"
17+
class="mx-auto md:saturate-0 rounded-xl ease-in-out duration-300 md:h-[640px] h-[150px] w-[150px] md:w-[90px] object-cover object-center md:group-hover:w-[120px] group-hover:saturate-100 transition-all"
1718
:src="getGithubUrl(person.github_account || '')" :alt="person.name" :title="person.name" width="300"
1819
height="300" >
1920

2021
<div
2122
class="speaker-details-background inset-0 space-y-2 absolute text-center top-0 left-0 flex flex-col justify-end">
2223
<div class="p-2 md:p-10 speaker-details md:opacity-0 flex flex-col items-center md:gap-2">
23-
<p class="text-verse-200 text-xs md:text-2xl block">
24+
<p class="text-verse-200 text-xs md:text-2xl block cursor-text">
2425
@{{ person.github_account }}
2526
</p>
26-
<h3 class="text-verse-100 font-extrabold text-sm md:text-4xl block">
27+
<h3 class="text-verse-100 font-extrabold text-sm md:text-4xl block cursor-text">
2728
{{ person.name }}
2829
</h3>
2930
<NuxtLink
@@ -50,9 +51,11 @@ const featuredSpeakers = ref(
5051
speakersResponse.filter((speaker: { featured: boolean }) => speaker.featured)
5152
);
5253
53-
const isCenter = (index: number, length: number) => {
54-
return index === Math.floor(length / 2);
55-
};
54+
const initialActiveSpeakerIndex = Math.floor(featuredSpeakers.value.length / 2);
55+
56+
const activeSpeakerId = ref<string>(
57+
featuredSpeakers.value[initialActiveSpeakerIndex].id
58+
);
5659
</script>
5760

5861
<style lang="postcss" scoped>

0 commit comments

Comments
 (0)