diff --git a/src/App.tsx b/src/App.tsx index 6e35607..18f25d1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,7 @@ import FeaturesLabeledList from '@/components/sections/features/FeaturesLabeledL import FooterSimpleCard from '@/components/sections/footer/FooterSimpleCard'; import HeroBrand from '@/components/sections/hero/HeroBrand'; import MetricsMinimalCards from '@/components/sections/metrics/MetricsMinimalCards'; -import NavbarCentered from '@/components/ui/NavbarCentered'; +import FloatingNav from '@/components/ui/FloatingNav'; import PricingLayeredCards from '@/components/sections/pricing/PricingLayeredCards'; import SocialProofMarquee from '@/components/sections/social-proof/SocialProofMarquee'; import TestimonialRatingCards from '@/components/sections/testimonial/TestimonialRatingCards'; @@ -14,33 +14,32 @@ import HeroTrustedBy from '@/components/ui/HeroTrustedBy'; export default function App() { return ( <> - + +
{ + const handleClick = useButtonClick(href); + return ( + + ); +}; + +export default function FloatingNav({ logo, navItems, ctaButton }: FloatingNavProps) { + const [visible, setVisible] = useState(true); + const [lastScrollY, setLastScrollY] = useState(0); + + const controlNavbar = () => { + if (typeof window !== 'undefined') { + if (window.scrollY > lastScrollY && window.scrollY > 100) { + setVisible(false); + } else { + setVisible(true); + } + setLastScrollY(window.scrollY); + } + }; + + useEffect(() => { + window.addEventListener('scroll', controlNavbar); + return () => { + window.removeEventListener('scroll', controlNavbar); + }; + }, [lastScrollY]); + + const CtaButtonHandler = useButtonClick(ctaButton.href); + + return ( + + {visible && ( + +
+ {logo} +
+ {navItems.map((item) => ( + + ))} +
+ +
+
+ )} +
+ ); +} \ No newline at end of file diff --git a/src/index.css b/src/index.css index b5dfd2c..a828f7f 100644 --- a/src/index.css +++ b/src/index.css @@ -141,15 +141,6 @@ body { min-height: 100vh; overscroll-behavior: none; overscroll-behavior-y: none; - padding-top: 5rem; -} - -#nav { - position: fixed; - top: 0; - width: 100%; - z-index: 1000; - background-color: var(--background); } h1,