import { useState, useEffect, useRef } from "react"; import HeroSection from "@/components/proposal/HeroSection"; import ServicesSection from "@/components/proposal/ServicesSection"; import PricingSection from "@/components/proposal/PricingSection"; import WhyUsSection from "@/components/proposal/WhyUsSection"; import ContactSection from "@/components/proposal/ContactSection"; import NavigationDots from "@/components/proposal/NavigationDots";const sections = ["Início", "Serviços", "Investimento", "Diferenciais", "Contato"];const Index = () => { const [activeSection, setActiveSection] = useState(0); const sectionRefs = useRef<(HTMLDivElement | null)[]>([]);useEffect(() => { const handleScroll = () => { const scrollPosition = window.scrollY + window.innerHeight / 2; sectionRefs.current.forEach((ref, index) => { if (ref) { const { offsetTop, offsetHeight } = ref; if (scrollPosition >= offsetTop && scrollPosition < offsetTop + offsetHeight) { setActiveSection(index); } } }); };window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []);const scrollToSection = (index: number) => { sectionRefs.current[index]?.scrollIntoView({ behavior: "smooth" }); };return (
(sectionRefs.current[0] = el)}>
(sectionRefs.current[1] = el)}>
(sectionRefs.current[2] = el)}>
(sectionRefs.current[3] = el)}>
(sectionRefs.current[4] = el)}>
); };export default Index;