"use client" import { useState, useEffect } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Key } from 'lucide-react' export function FloatingCTA() { const [showFloatingCTA, setShowFloatingCTA] = useState(false) useEffect(() => { const handleScroll = () => { const scrollY = window.scrollY const windowHeight = window.innerHeight const documentHeight = document.documentElement.scrollHeight // Show floating CTA when user has scrolled past the hero section and generator is not in view const shouldShow = scrollY > windowHeight * 0.5 && scrollY < documentHeight - windowHeight * 0.3 setShowFloatingCTA(shouldShow) } window.addEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll) }, []) const scrollToGenerator = () => { const generatorElement = document.getElementById('generator') if (generatorElement) { generatorElement.scrollIntoView({ behavior: 'smooth' }) } } return ( {showFloatingCTA && ( Generate Password )} ) }