Skip to content

Commit f5aa3bc

Browse files
committed
Update
1 parent 94738ba commit f5aa3bc

File tree

9 files changed

+139
-1379
lines changed

9 files changed

+139
-1379
lines changed

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export default defineConfig({
116116
enableInDevelopment: true,
117117
}),
118118
compress({
119+
Images: false,
119120
SVG: false,
120121
}),
121122
dontDie(),

pnpm-lock.yaml

Lines changed: 66 additions & 1249 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/sw2.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/components/BaseHead.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import { ClientRouter } from "astro:transitions";
23
interface Props {
34
title: string;
45
description: string;
@@ -26,6 +27,8 @@ const { title, description, image = "/social-card.png" } = Astro.props;
2627
<!-- Canonical URL -->
2728
<link rel="canonical" href={canonicalURL} />
2829

30+
<ClientRouter />
31+
2932
<!-- Primary Meta Tags -->
3033
<title>{title}</title>
3134
<meta name="title" content={title} />

src/components/sections/speakers.astro

Lines changed: 66 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -70,102 +70,93 @@ const sectionSubtitle = "Meet some of our amazing speakers";
7070
</Section>
7171

7272
<script>
73-
document.addEventListener('DOMContentLoaded', () => {
74-
const track = document.querySelector('.speakers-track') as HTMLElement;
75-
const slides = document.querySelectorAll('.speaker-slide');
76-
const totalOriginalSlides = slides.length / 2;
77-
78-
if (!track || slides.length === 0) return;
79-
80-
let currentPosition = 0;
81-
const scrollSpeed = 4000;
82-
let slidingInterval: ReturnType<typeof setInterval> | null = null;
83-
84-
// Function to determine slides per view based on window width
85-
function getSlidesPerView() {
86-
const width = window.innerWidth;
87-
if (width <= 480) return 1;
88-
if (width <= 640) return 2;
89-
if (width <= 768) return 3;
90-
if (width <= 1024) return 4;
91-
return 5;
92-
}
73+
document.addEventListener('DOMContentLoaded', () => {
74+
const track = document.querySelector('.speakers-track') as HTMLElement;
75+
const slides = document.querySelectorAll('.speaker-slide');
76+
const totalOriginalSlides = slides.length / 2;
77+
78+
if (!track || slides.length === 0) return;
79+
80+
let currentPosition = 0;
81+
const scrollSpeed = 4000;
82+
let slidingInterval: number | null = null;
83+
84+
function getSlidesPerView() {
85+
const width = window.innerWidth;
86+
if (width <= 480) return 1;
87+
if (width <= 640) return 2;
88+
if (width <= 768) return 3;
89+
if (width <= 1024) return 4;
90+
return 5;
91+
}
9392

94-
function updateCarouselSettings() {
95-
const slidesPerView = getSlidesPerView();
96-
const slideWidth = 100 / slidesPerView;
93+
function updateCarouselSettings() {
94+
const slidesPerView = getSlidesPerView();
95+
const slideWidth = 100 / slidesPerView;
9796

98-
// Reset position when breakpoint changes
99-
currentPosition = 0;
100-
track.style.transition = 'none';
101-
track.style.transform = `translateX(0)`;
97+
currentPosition = 0;
98+
track.style.transition = 'none';
99+
track.style.transform = `translateX(0)`;
102100

103-
// Clear and restart animation
104-
if (slidingInterval !== null) {
105-
clearInterval(slidingInterval);
106-
}
107-
startAnimation(slideWidth);
101+
if (slidingInterval !== null) {
102+
clearInterval(slidingInterval);
108103
}
104+
startAnimation(slideWidth);
105+
}
106+
107+
function startAnimation(slideWidth: number) {
108+
moveCarousel();
109+
slidingInterval = window.setInterval(moveCarousel, scrollSpeed);
109110

110-
function startAnimation(slideWidth: number) {
111-
// Initial setup
112-
moveCarousel();
113-
slidingInterval = setInterval(moveCarousel, scrollSpeed);
111+
function moveCarousel() {
112+
currentPosition += slideWidth;
114113

115-
function moveCarousel() {
116-
currentPosition += slideWidth;
114+
track.style.transition = 'transform 1000ms linear';
115+
track.style.transform = `translateX(-${currentPosition}%)`;
117116

118-
track.style.transition = 'transform 1000ms linear';
119-
track.style.transform = `translateX(-${currentPosition}%)`;
117+
if (currentPosition >= slideWidth * totalOriginalSlides) {
118+
setTimeout(() => {
119+
track.style.transition = 'none';
120+
currentPosition = 0;
121+
track.style.transform = `translateX(0)`;
120122

121-
// Reset when we've scrolled through the original set of slides
122-
if (currentPosition >= slideWidth * totalOriginalSlides) {
123123
setTimeout(() => {
124-
track.style.transition = 'none';
125-
currentPosition = 0;
126-
track.style.transform = `translateX(0)`;
127-
128-
setTimeout(() => {
129-
track.style.transition = 'transform 1000ms linear';
130-
}, 20);
131-
}, 1000);
132-
}
124+
track.style.transition = 'transform 1000ms linear';
125+
}, 20);
126+
}, 1000);
133127
}
134128
}
129+
}
135130

136-
// Start the carousel
131+
updateCarouselSettings();
132+
133+
window.addEventListener('resize', () => {
137134
updateCarouselSettings();
135+
});
138136

139-
// Update on window resize
140-
window.addEventListener('resize', () => {
141-
updateCarouselSettings();
142-
});
137+
const carouselContainer = document.querySelector('.speakers-carousel-container');
138+
carouselContainer?.addEventListener('mouseenter', () => {
139+
if (slidingInterval !== null) {
140+
clearInterval(slidingInterval);
141+
slidingInterval = null;
142+
}
143+
});
143144

144-
// Pause on hover
145-
const carouselContainer = document.querySelector('.speakers-carousel-container');
146-
carouselContainer?.addEventListener('mouseenter', () => {
145+
carouselContainer?.addEventListener('mouseleave', () => {
146+
updateCarouselSettings();
147+
});
148+
149+
document.addEventListener('visibilitychange', () => {
150+
if (document.hidden) {
147151
if (slidingInterval !== null) {
148152
clearInterval(slidingInterval);
149153
slidingInterval = null;
150154
}
151-
});
152-
153-
carouselContainer?.addEventListener('mouseleave', () => {
155+
} else {
154156
updateCarouselSettings();
155-
});
156-
157-
// Pause when tab is not visible
158-
document.addEventListener('visibilitychange', () => {
159-
if (document.hidden) {
160-
if (slidingInterval !== null) {
161-
clearInterval(slidingInterval);
162-
slidingInterval = null;
163-
}
164-
} else {
165-
updateCarouselSettings();
166-
}
167-
});
157+
}
168158
});
159+
});
169160
</script>
170161

171162
<style>

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const externalDomain = new URL(Astro.site || "").hostname;
2323
---
2424

2525
<!DOCTYPE html>
26-
<html lang="en">
26+
<html lang="en" transition:name="root" transition:animate="initial">
2727
<head>
2828
<BaseHead title={title} description={description} />
2929
<slot name="head" />

src/pages/speaker/[slug].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function getGitHosting(url: string): string | undefined {
9393
<div class="flex items-start">
9494
<div class="border-4 border-white rounded-lg shadow-lg inline-block mb-10">
9595
<Image
96+
transition:animate="fade"
9697
src={entry.data.avatar}
9798
alt={entry.data.name}
9899
height={400}

src/pages/speakers.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const description = "Our conference speakers organized alphabetically";
8181
{speaker.data.avatar ? (
8282

8383
<Image
84+
transition:animate="fade"
8485
src={speaker.data.avatar}
8586
alt={`${speaker.data.name}'s profile picture`}
8687
height={250}

src/styles/global.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
z-index: 9999;
3232
}
3333

34-
html {
35-
scroll-behavior: smooth;
36-
}
37-
3834
body {
3935
@apply bg-body-background text-text;
4036
}

0 commit comments

Comments
 (0)