diff --git a/app/(pages)/(index-page)/_components/SandCastle.tsx b/app/(pages)/(index-page)/_components/SandCastle.tsx index 44dfdfe..3d14466 100644 --- a/app/(pages)/(index-page)/_components/SandCastle.tsx +++ b/app/(pages)/(index-page)/_components/SandCastle.tsx @@ -63,7 +63,7 @@ function WhatIsHackDavisText() {

is one of the - largest collegiate hackathon in California, where + largest collegiate hackathons in California, where over 850 students, creators, and leaders come together to{' '} create for social good.

diff --git a/app/(pages)/about-us/_components/Recap/Recap.tsx b/app/(pages)/about-us/_components/Recap/Recap.tsx index 791407b..3fda368 100644 --- a/app/(pages)/about-us/_components/Recap/Recap.tsx +++ b/app/(pages)/about-us/_components/Recap/Recap.tsx @@ -8,7 +8,7 @@ export default function Recap() {

HackDavis 2024 Recap

-
+
diff --git a/app/(pages)/about-us/_components/Recap/recap_carousel.tsx b/app/(pages)/about-us/_components/Recap/recap_carousel.tsx index 4d58a3d..abe3aa9 100644 --- a/app/(pages)/about-us/_components/Recap/recap_carousel.tsx +++ b/app/(pages)/about-us/_components/Recap/recap_carousel.tsx @@ -37,13 +37,29 @@ export default function RecapCarousel() { const [position, setPosition] = useState(2); const [touchStart, setTouchStart] = useState(0); const [touchEnd, setTouchEnd] = useState(0); + const [xOffset, setXOffset] = useState(-250); useEffect(() => { const interval = setInterval(() => { - setPosition((prev) => (prev >= 5 ? 1 : prev + 1)); - }, 5000); // Increased to 5 seconds for slower rotation + setPosition((prev) => (prev + 1) % images.length); + }, 5000); - return () => clearInterval(interval); + // Handle the initial window width and subsequent resizes + const handleResize = () => { + setXOffset(window.innerWidth < 400 ? -100 : -250); + }; + + // Set initial value + handleResize(); + + // Add event listener for window resize + window.addEventListener('resize', handleResize); + + // Cleanup + return () => { + clearInterval(interval); + window.removeEventListener('resize', handleResize); + }; }, []); const handleTouchStart = (e: React.TouchEvent) => { @@ -57,12 +73,12 @@ export default function RecapCarousel() { const handleTouchEnd = () => { if (touchStart - touchEnd > 75) { // Swipe left - setPosition((prev) => (prev >= 5 ? 1 : prev + 1)); + setPosition((prev) => (prev + 1) % images.length); } if (touchStart - touchEnd < -75) { // Swipe right - setPosition((prev) => (prev <= 1 ? 5 : prev - 1)); + setPosition((prev) => (prev - 1 + images.length) % images.length); } }; @@ -76,18 +92,20 @@ export default function RecapCarousel() { onTouchEnd={handleTouchEnd} > {images.map((image, index) => { - const offset = index + 1; - const r = position - offset; - const absR = Math.max(Math.abs(r), r); - const zIndex = position - absR; + const totalImages = images.length; + const r = + ((position - index + totalImages / 2) % totalImages) - + totalImages / 2; + const absR = Math.abs(r); + const zIndex = totalImages / 2 - absR; return (