import { useState, useEffect } from 'react' import { X } from 'lucide-react' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' interface FloatingSurveyCTAProps { isVisible: boolean onClose: () => void onTakeSurvey: () => void } export const FloatingSurveyCTA = ({ isVisible, onClose, onTakeSurvey }: FloatingSurveyCTAProps) => { const [shouldRender, setShouldRender] = useState(false) useEffect(() => { if (isVisible) { setShouldRender(true) } else { // Delay unmounting to allow exit animation const timer = setTimeout(() => setShouldRender(false), 500) return () => clearTimeout(timer) } }, [isVisible]) if (!shouldRender) return null return (
Take our 2-min survey to help us improve and claim your discount.