Skip to content

Commit 5162ee4

Browse files
committed
Update mobile view.
1 parent 960ac6d commit 5162ee4

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

src/components/sections/speakers.astro

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ const featuredSpeakers = getRandomSpeakers(validSpeakers, 15);
1919
const sectionTitle = "Featured Speakers";
2020
const sectionSubtitle = "Meet some of our amazing speakers";
2121
22-
// Helper function to truncate names if needed
23-
function formatSpeakerName(name: string) {
24-
// Option: You could truncate very long names
25-
// if (name.length > 20) {
26-
// return name.substring(0, 18) + '...';
27-
// }
28-
return name;
29-
}
3022
---
3123

3224
<section class="py-16 px-4 bg-gray-50">
@@ -53,17 +45,9 @@ function formatSpeakerName(name: string) {
5345
/>
5446
</div>
5547
<div class="p-4 text-center h-[88px] flex flex-col justify-center">
56-
<!-- Solution: Use text-ellipsis with 2 lines max and remove whitespace-nowrap -->
5748
<h3 class="font-bold text-lg text-gray-900 group-hover:text-primary transition-colors line-clamp-2">
58-
{formatSpeakerName(speaker.data.name)}
49+
{speaker.data.name}
5950
</h3>
60-
61-
<!-- Optional: Add role/title with ellipsis if available -->
62-
{speaker.data.title && (
63-
<p class="text-sm text-gray-600 mt-1 line-clamp-1">
64-
{speaker.data.title}
65-
</p>
66-
)}
6751
</div>
6852
</div>
6953
</a>
@@ -95,7 +79,7 @@ function formatSpeakerName(name: string) {
9579
const scrollSpeed = 4000;
9680
let slidingInterval: ReturnType<typeof setInterval> | null = null;
9781

98-
// Function to determine slides per view based on window width
82+
9983
function getSlidesPerView() {
10084
const width = window.innerWidth;
10185
if (width <= 480) return 1;
@@ -109,20 +93,20 @@ function formatSpeakerName(name: string) {
10993
const slidesPerView = getSlidesPerView();
11094
const slideWidth = 100 / slidesPerView;
11195

112-
// Reset position when breakpoint changes
96+
11397
currentPosition = 0;
11498
track.style.transition = 'none';
11599
track.style.transform = `translateX(0)`;
116100

117-
// Clear and restart animation
101+
118102
if (slidingInterval !== null) {
119103
clearInterval(slidingInterval);
120104
}
121105
startAnimation(slideWidth);
122106
}
123107

124108
function startAnimation(slideWidth: number) {
125-
// Initial setup
109+
126110
moveCarousel();
127111
slidingInterval = setInterval(moveCarousel, scrollSpeed);
128112

@@ -132,7 +116,7 @@ function formatSpeakerName(name: string) {
132116
track.style.transition = 'transform 1000ms linear';
133117
track.style.transform = `translateX(-${currentPosition}%)`;
134118

135-
// Reset when we've scrolled through the original set of slides
119+
136120
if (currentPosition >= slideWidth * totalOriginalSlides) {
137121
setTimeout(() => {
138122
track.style.transition = 'none';
@@ -147,15 +131,15 @@ function formatSpeakerName(name: string) {
147131
}
148132
}
149133

150-
// Start the carousel
134+
151135
updateCarouselSettings();
152136

153-
// Update on window resize
137+
154138
window.addEventListener('resize', () => {
155139
updateCarouselSettings();
156140
});
157141

158-
// Pause on hover
142+
159143
const carouselContainer = document.querySelector('.speakers-carousel-container');
160144
carouselContainer?.addEventListener('mouseenter', () => {
161145
if (slidingInterval !== null) {
@@ -168,7 +152,7 @@ function formatSpeakerName(name: string) {
168152
updateCarouselSettings();
169153
});
170154

171-
// Pause when tab is not visible
155+
172156
document.addEventListener('visibilitychange', () => {
173157
if (document.hidden) {
174158
if (slidingInterval !== null) {
@@ -192,7 +176,6 @@ function formatSpeakerName(name: string) {
192176
will-change: transform;
193177
}
194178

195-
/* Line clamping for text overflow */
196179
.line-clamp-1 {
197180
display: -webkit-box;
198181
-webkit-line-clamp: 1;
@@ -207,7 +190,6 @@ function formatSpeakerName(name: string) {
207190
overflow: hidden;
208191
}
209192

210-
/* These styles match the responsive classes used in the HTML */
211193
@media (max-width: 1024px) {
212194
.speaker-slide {
213195
width: 25%;

0 commit comments

Comments
 (0)