diff --git a/src/app/page.tsx b/src/app/page.tsx
index 8062906..18f15da 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -56,6 +56,16 @@ export default function LandingPage() {
}
};
+ const scrollToShoes = () => {
+ const shoesSectionElement = document.getElementById('shoes');
+ if (shoesSectionElement) {
+ shoesSectionElement.scrollIntoView({
+ behavior: 'smooth',
+ block: 'start'
+ });
+ }
+ };
+
const scrollToTop = () => {
const heroSectionElement = document.getElementById('hero');
if (heroSectionElement) {
@@ -238,6 +248,19 @@ export default function LandingPage() {
+ {/* Fixed "Go to Shoes" Button */}
+
+
{/* Fixed Top Social & Contact Bar */}
{/* Instagram */}
@@ -518,6 +541,9 @@ export default function LandingPage() {
tagAnimation="slide-up"
gridVariant="three-columns-all-equal-width"
animationType="slide-up"
+ buttons={[
+ { text: "Explore All Shoes", onClick: scrollToShoes }
+ ]}
products={[
{
id: "shoe-1", name: "Classic Satin Heels", price: "Starting at $250", variant: "White", imageSrc: "http://img.b2bpic.net/free-photo/elegant-beautiful-fashionable-woman-blonde-long-white-dre_7502-4897.jpg?_wi=2", imageAlt: "Classic white satin bridal heels"
diff --git a/src/hooks/useScrollDetection.ts b/src/hooks/useScrollDetection.ts
new file mode 100644
index 0000000..7ba9a3b
--- /dev/null
+++ b/src/hooks/useScrollDetection.ts
@@ -0,0 +1,78 @@
+import { useEffect, useRef, useState } from 'react';
+
+interface UseScrollDetectionOptions {
+ targetElementId: string;
+ scrollThreshold?: number;
+ onStateChange?: (state: {
+ isScrollingPastTarget: boolean;
+ isScrollingBack: boolean;
+ scrollProgress: number;
+ }) => void;
+}
+
+interface UseScrollDetectionReturn {
+ isScrollingPastTarget: boolean;
+ isScrollingBack: boolean;
+ scrollProgress: number;
+}
+
+export function useScrollDetection({
+ targetElementId,
+ scrollThreshold = 0.3,
+ onStateChange,
+}: UseScrollDetectionOptions): UseScrollDetectionReturn {
+ const [isScrollingPastTarget, setIsScrollingPastTarget] = useState(false);
+ const [isScrollingBack, setIsScrollingBack] = useState(false);
+ const [scrollProgress, setScrollProgress] = useState(0);
+ const lastScrollYRef = useRef(0);
+ const targetElementRef = useRef(null);
+
+ useEffect(() => {
+ // Get target element
+ targetElementRef.current = document.getElementById(targetElementId);
+
+ const handleScroll = () => {
+ if (!targetElementRef.current) return;
+
+ const targetRect = targetElementRef.current.getBoundingClientRect();
+ const windowHeight = window.innerHeight;
+ const scrollY = window.scrollY;
+ const currentScrollDirection = scrollY > lastScrollYRef.current ? 'down' : 'up';
+
+ // Calculate if we've scrolled past the target element
+ const targetTop = targetRect.top + scrollY;
+ const thresholdDistance = window.innerHeight * scrollThreshold;
+ const isPastTarget = scrollY > targetTop - thresholdDistance;
+
+ // Determine scroll direction
+ const isScrollingBackward = currentScrollDirection === 'up';
+
+ // Calculate scroll progress (0 to 1)
+ const progress = Math.min(scrollY / (targetTop + thresholdDistance), 1);
+
+ setIsScrollingPastTarget(isPastTarget);
+ setIsScrollingBack(isScrollingBackward);
+ setScrollProgress(progress);
+
+ // Call callback if provided
+ if (onStateChange) {
+ onStateChange({
+ isScrollingPastTarget: isPastTarget,
+ isScrollingBack: isScrollingBackward,
+ scrollProgress: progress,
+ });
+ }
+
+ lastScrollYRef.current = scrollY;
+ };
+
+ window.addEventListener('scroll', handleScroll, { passive: true });
+ return () => window.removeEventListener('scroll', handleScroll);
+ }, [targetElementId, scrollThreshold, onStateChange]);
+
+ return {
+ isScrollingPastTarget,
+ isScrollingBack,
+ scrollProgress,
+ };
+}