diff --git a/src/app/page.tsx b/src/app/page.tsx index 2be79e5..790d5ef 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -46,37 +46,25 @@ export default function LandingPage() { setScrollDirection('up'); } - // 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 gallery section - show View More when visible + if (galleryContainerRef.current && galleryButtonContainerRef.current) { + const rect = galleryButtonContainerRef.current.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 shoes section - show View More when visible + if (shoesContainerRef.current && shoesButtonContainerRef.current) { + const rect = shoesButtonContainerRef.current.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); - } + // Check veils section - show View More when visible + if (veilsContainerRef.current && veilsButtonContainerRef.current) { + const rect = veilsButtonContainerRef.current.getBoundingClientRect(); + const isInViewport = rect.top < window.innerHeight && rect.bottom > 0; + setShowVeilsViewMore(isInViewport); } setLastScrollY(currentScrollY); @@ -449,19 +437,19 @@ export default function LandingPage() { _key: `gallery-${index}` }))} /> + - {/* View More Button - Positioned at bottom right of gallery section */} + {/* View More Button - Positioned at bottom right of gallery section */} +
{showGalleryViewMore && ( -
- -
+ )}
@@ -595,19 +583,19 @@ export default function LandingPage() { } ]} /> + - {/* View More Button for Shoes - Positioned at bottom right of shoes section */} + {/* View More Button for Shoes - Positioned at bottom right of shoes section */} +
{showShoesViewMore && ( -
- -
+ )}
@@ -645,19 +633,19 @@ export default function LandingPage() { } ]} /> + - {/* View More Button for Veils - Positioned at bottom right of veils section */} + {/* View More Button for Veils - Positioned at bottom right of veils section */} +
{showVeilsViewMore && ( -
- -
+ )}