From b5f4ecf5d7b8f1d4f241ca881ea1a2c6603a1827 Mon Sep 17 00:00:00 2001 From: bender Date: Tue, 3 Mar 2026 05:06:31 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 223 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 152 insertions(+), 71 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index b646dc9..ee20e5e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,6 +2,8 @@ import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import { useState, useEffect } from "react"; +import gsap from "gsap"; +import ScrollTrigger from "gsap/dist/ScrollTrigger"; import NavbarStyleApple from "@/components/navbar/NavbarStyleApple/NavbarStyleApple"; import HeroCentered from "@/components/sections/hero/HeroCentered"; import MetricSplitMediaAbout from "@/components/sections/about/MetricSplitMediaAbout"; @@ -12,32 +14,124 @@ import FaqBase from "@/components/sections/faq/FaqBase"; import ContactSplit from "@/components/sections/contact/ContactSplit"; import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis"; import TimelineProcessFlow from "@/components/cardStack/layouts/timelines/TimelineProcessFlow"; -import { Moon, Sun } from "lucide-react"; +import { Moon, Sun, Sparkles } from "lucide-react"; + +gsap.registerPlugin(ScrollTrigger); const lightTheme = { - "--background": "#ffffff", "--card": "#f9f9f9", "--foreground": "#000000", "--primary-cta": "#000000", "--secondary-cta": "#f9f9f9", "--accent": "#e2e2e2", "--background-accent": "#c4c4c4", "--primary-cta-text": "#ffffff", "--secondary-cta-text": "#000000" -}; + "--background": "#ffffff", "--card": "#f9f9f9", "--foreground": "#000000", "--primary-cta": "#000000", "--secondary-cta": "#f9f9f9", "--accent": "#e2e2e2", "--background-accent": "#c4c4c4", "--primary-cta-text": "#ffffff", "--secondary-cta-text": "#000000"}; const darkTheme = { - "--background": "#0a0a0a", "--card": "#1a1a1a", "--foreground": "#ffffff", "--primary-cta": "#ffffff", "--secondary-cta": "#1a1a1a", "--accent": "#737373", "--background-accent": "#737373", "--primary-cta-text": "#0a0a0a", "--secondary-cta-text": "#ffffff" -}; + "--background": "#0a0a0a", "--card": "#1a1a1a", "--foreground": "#ffffff", "--primary-cta": "#ffffff", "--secondary-cta": "#1a1a1a", "--accent": "#737373", "--background-accent": "#737373", "--primary-cta-text": "#0a0a0a", "--secondary-cta-text": "#ffffff"}; export default function LandingPage() { const [isDarkMode, setIsDarkMode] = useState(false); const [mounted, setMounted] = useState(false); + const theme = isDarkMode ? darkTheme : lightTheme; + useEffect(() => { setMounted(true); }, []); - const theme = isDarkMode ? darkTheme : lightTheme; + useEffect(() => { + if (!mounted) return; + + // Apply theme colors + Object.entries(theme).forEach(([key, value]) => { + document.documentElement.style.setProperty(key, value); + }); + + // Enhanced GSAP animations + gsap.utils.toArray("[data-section]").forEach((section: any) => { + // Fade in sections on scroll + gsap.fromTo( + section, + { opacity: 0, y: 50 }, + { + opacity: 1, + y: 0, + duration: 1, + scrollTrigger: { + trigger: section, + start: "top 80%", toggleActions: "play none none reverse", once: false, + }, + } + ); + }); + + // Animate text elements with stagger + gsap.utils.toArray("h1, h2, h3").forEach((element: any) => { + gsap.fromTo( + element, + { opacity: 0, y: 20 }, + { + opacity: 1, + y: 0, + duration: 0.8, + scrollTrigger: { + trigger: element, + start: "top 85%", toggleActions: "play none none reverse"}, + } + ); + }); + + // Animate cards with parallax effect + gsap.utils.toArray("[class*='card']").forEach((card: any) => { + gsap.fromTo( + card, + { opacity: 0, scale: 0.95, y: 30 }, + { + opacity: 1, + scale: 1, + y: 0, + duration: 0.6, + scrollTrigger: { + trigger: card, + start: "top 75%", toggleActions: "play none none reverse"}, + } + ); + }); + + // Hover effects on buttons + gsap.utils.toArray("button[type='submit'], a[href*='#']").forEach((btn: any) => { + btn.addEventListener("mouseenter", () => { + gsap.to(btn, { scale: 1.05, duration: 0.3 }); + }); + btn.addEventListener("mouseleave", () => { + gsap.to(btn, { scale: 1, duration: 0.3 }); + }); + }); + + // Parallax scroll for hero section + const heroSection = document.getElementById("hero"); + if (heroSection) { + gsap.to(heroSection, { + backgroundPosition: "50% 50%", ease: "none", scrollTrigger: { + trigger: heroSection, + start: "top top", end: "bottom top", scrub: 1, + markers: false, + }, + }); + } + + // Floating animation for decorative elements + gsap.utils.toArray("[data-float]").forEach((element: any) => { + gsap.to(element, { + y: -20, + duration: 3, + repeat: -1, + yoyo: true, + ease: "sine.inOut"}); + }); + + return () => { + ScrollTrigger.getAll().forEach((trigger) => trigger.kill()); + }; + }, [mounted, isDarkMode]); const toggleTheme = () => { setIsDarkMode(!isDarkMode); - const newTheme = !isDarkMode ? darkTheme : lightTheme; - Object.entries(newTheme).forEach(([key, value]) => { - document.documentElement.style.setProperty(key, value); - }); }; if (!mounted) return null; @@ -64,7 +158,7 @@ export default function LandingPage() { { name: "How It Works", id: "process" }, { name: "Features", id: "features" }, { name: "FAQ", id: "faq" }, - { name: "Contact", id: "contact" } + { name: "Contact", id: "contact" }, ]} />