From d68a1badc96f573242a9dbbcd31b612e6cf1884a Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 21 Mar 2026 23:03:56 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 166 ++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 90 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 1363120..509e92a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -15,17 +15,15 @@ import { useState, useEffect, useRef } from "react"; export default function LandingPage() { const [showModal, setShowModal] = useState(false); const [showBackToTop, setShowBackToTop] = useState(false); - const [showViewMoreButton, setShowViewMoreButton] = useState(false); - const [showShoesArrow, setShowShoesArrow] = useState(false); - const [showShoesMoreButton, setShowShoesMoreButton] = useState(true); - const [showVeilsMoreButton, setShowVeilsMoreButton] = useState(true); + const [showGalleryViewMore, setShowGalleryViewMore] = useState(false); + const [showShoesViewMore, setShowShoesViewMore] = useState(false); + const [showVeilsViewMore, setShowVeilsViewMore] = useState(false); const [scrollDirection, setScrollDirection] = useState<'up' | 'down'>('down'); const [lastScrollY, setLastScrollY] = useState(0); - const viewMoreButtonRef = useRef(null); - const sixthItemRef = useRef(null); const galleryRef = useRef(null); const shoesRef = useRef(null); const veilsRef = useRef(null); + const galleryContainerRef = useRef(null); const shoesContainerRef = useRef(null); const veilsContainerRef = useRef(null); @@ -44,24 +42,41 @@ export default function LandingPage() { } else { setScrollDirection('up'); } - setLastScrollY(currentScrollY); - // Check if gallery is in view - if (galleryRef.current) { - const rect = galleryRef.current.getBoundingClientRect(); - const isInView = rect.top < window.innerHeight && rect.bottom > 0; - - // Show button when gallery is scrolled past (user scrolls down past gallery) - // Hide button when user scrolls back to gallery area - if (!isInView && currentScrollY > lastScrollY) { - // We've scrolled past the gallery, show the up arrow - setShowViewMoreButton(true); - } else if (isInView && currentScrollY < lastScrollY) { - // We're back at or above the gallery, hide the button - setShowViewMoreButton(false); + // Check gallery section - show View More when 6th item is visible + if (galleryContainerRef.current) { + const items = galleryContainerRef.current.querySelectorAll('[data-product-item]'); + if (items.length > 0) { + const sixthItem = items[5]; + const rect = sixthItem.getBoundingClientRect(); + const isInViewport = rect.top < window.innerHeight && rect.bottom > 0; + setShowGalleryViewMore(isInViewport); } } + // Check shoes section - show View More when 6th item is visible + if (shoesContainerRef.current) { + const items = shoesContainerRef.current.querySelectorAll('[data-product-item]'); + if (items.length > 0) { + const sixthItem = items[5]; + const rect = sixthItem.getBoundingClientRect(); + const isInViewport = rect.top < window.innerHeight && rect.bottom > 0; + setShowShoesViewMore(isInViewport); + } + } + + // Check veils section - show View More when 6th item is visible + if (veilsContainerRef.current) { + const items = veilsContainerRef.current.querySelectorAll('[data-product-item]'); + if (items.length > 0) { + const sixthItem = items[5]; + const rect = sixthItem.getBoundingClientRect(); + const isInViewport = rect.top < window.innerHeight && rect.bottom > 0; + setShowVeilsViewMore(isInViewport); + } + } + + setLastScrollY(currentScrollY); ticking = false; }); ticking = true; @@ -271,47 +286,6 @@ export default function LandingPage() { /> - {/* Fixed "Go to Dresses" Button - Only visible on home page */} - - - {/* Fixed "Back to Dresses" Button - Appears when scrolled past gallery */} - {showViewMoreButton && ( - - )} - - {/* Fixed "Go to Shoes" Button - Always visible */} - - {/* Fixed Top Social & Contact Bar */}
{/* Instagram */} @@ -456,7 +430,7 @@ export default function LandingPage() {
@@ -666,17 +647,22 @@ export default function LandingPage() { ]} /> - {/* More Button for Veils - Always visible */} -
- -
+ {/* View More Button for Veils - Appears when 6th item is scrolled to */} + {showVeilsViewMore && ( +
+
+ +
+
+ )} -- 2.49.1