"use client"; import { useState, useEffect } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { X } from "lucide-react"; export default function ScrollPopup() { const [showPopup, setShowPopup] = useState(false); const [closed, setClosed] = useState(false); useEffect(() => { const handleScroll = () => { if (window.scrollY > 300 && !closed) { setShowPopup(true); } }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, [closed]); useEffect(() => { let timeout: NodeJS.Timeout; if (closed) { timeout = setTimeout(() => { setClosed(false); setShowPopup(true); }, 30000); // 30 seconds } return () => clearTimeout(timeout); }, [closed]); return (
{showPopup && ( {/* Close Button */} {/* Text Content */}

Apply for a Credit Card

Get up to AED 1500 Welcome Bonus.

{/* Input & Button */}

*T&C apply

)}
); }