diff --git a/web/public/carousel_one.png b/web/public/carousel_one.png new file mode 100644 index 0000000..f9155b6 Binary files /dev/null and b/web/public/carousel_one.png differ diff --git a/web/public/carousel_two.png b/web/public/carousel_two.png new file mode 100644 index 0000000..53a8301 Binary files /dev/null and b/web/public/carousel_two.png differ diff --git a/web/public/nerdy-merlion.png b/web/public/nerdy-merlion.png new file mode 100644 index 0000000..d382f1f Binary files /dev/null and b/web/public/nerdy-merlion.png differ diff --git a/web/src/app/about/page.tsx b/web/src/app/about/page.tsx index 52a5c3f..50adf7a 100644 --- a/web/src/app/about/page.tsx +++ b/web/src/app/about/page.tsx @@ -1,15 +1,166 @@ +'use client' + +import { useState, useEffect, useCallback, useRef } from 'react' +import Image from 'next/image' import Hero from '@/components/Hero' +// TODO: replace with CMS data matching field requirements +const carouselImages = [ + { src: '/carousel_two.png', alt: 'SSA Event 1' }, + { src: '/carousel_one.png', alt: 'SSA Event 2' }, + { src: '/carousel_two.png', alt: 'SSA Event 3' }, +] + export default function AboutPage() { + const [current, setCurrent] = useState(0) + const intervalRef = useRef | null>(null) + const touchStartX = useRef(null) + + const startTimer = useCallback(() => { + if (intervalRef.current) clearInterval(intervalRef.current) + intervalRef.current = setInterval(() => { + setCurrent((prev) => (prev + 1) % carouselImages.length) + }, 6000) + }, []) + + useEffect(() => { + startTimer() + return () => { + if (intervalRef.current) clearInterval(intervalRef.current) + } + }, [startTimer]) + + const goTo = useCallback( + (index: number) => { + setCurrent(index) + startTimer() + }, + [startTimer], + ) + + const goPrev = useCallback(() => { + goTo((current - 1 + carouselImages.length) % carouselImages.length) + }, [current, goTo]) + + const goNext = useCallback(() => { + goTo((current + 1) % carouselImages.length) + }, [current, goTo]) + + const handleTouchStart = (e: React.TouchEvent) => { + touchStartX.current = e.touches[0].clientX + } + + const handleTouchEnd = (e: React.TouchEvent) => { + if (touchStartX.current === null) return + const diff = touchStartX.current - e.changedTouches[0].clientX + if (Math.abs(diff) > 50) { + if (diff > 0) { + goNext() + } else { + goPrev() + } + } + touchStartX.current = null + } + return ( -
- -
{/* Content coming soon */}
+
+
+ +
+ + {/* Gap between hero and carousel */} +
+ + {/* Image carousel */} +
+
+
+ {/* Sliding track */} +
+ {carouselImages.map((image, index) => ( +
+ {image.alt} +
+ ))} +
+
+ + {/* Prev arrow */} + + + {/* Next arrow */} + +
+ + {/* Dot navigation */} +
+ {carouselImages.map((_, index) => ( + + ))} +
+
) }