/* eslint-disable react/prop-types */ /** * WhatsAppFab · Floating Action Button persistente en todas las páginas. * * Aparece después de un pequeño delay para no interferir con el primer * impacto visual del hero. Bottom-right por convención (no compite con * el lado izquierdo del cursor custom). * * EDITAR: cambiar PHONE_NUMBER al número real de Prosperia antes de publicar. */ const { useState: uS_Wa, useEffect: uE_Wa } = React; // EDITAR: número real de Prosperia (formato internacional sin +, sin espacios) const PHONE_NUMBER = '528136050471'; // tomado del footer · oficina central const DEFAULT_MESSAGE = encodeURIComponent( 'Hola, encontré Prosperia en su sitio. Me gustaría conversar sobre un proyecto.' ); function WhatsAppFab() { const [visible, setVisible] = uS_Wa(false); uE_Wa(() => { // Aparece a los 1500ms — deja respirar al hero const t = setTimeout(() => setVisible(true), 1500); return () => clearTimeout(t); }, []); const href = `https://wa.me/${PHONE_NUMBER}?text=${DEFAULT_MESSAGE}`; return ( Conversemos ); } const waStyles = { fab: { position: 'fixed', bottom: 24, right: 24, zIndex: 950, display: 'inline-flex', alignItems: 'center', gap: 12, paddingInline: 22, paddingBlock: 14, background: '#25D366', color: '#fff', textDecoration: 'none', borderRadius: 999, boxShadow: '0 8px 24px rgba(37, 211, 102, 0.35), 0 2px 8px rgba(0,0,0,0.18)', fontWeight: 700, fontSize: 14, letterSpacing: '0.06em', cursor: 'pointer', transition: 'opacity 380ms ease, transform 380ms cubic-bezier(0.16,1,0.3,1), box-shadow 240ms ease', willChange: 'opacity, transform', }, label: { color: '#fff', fontWeight: 700, }, }; const waMQ = document.createElement('style'); waMQ.textContent = ` a[aria-label="Conversar por WhatsApp con Prosperia"]:hover { transform: translateY(-3px) scale(1.04) !important; box-shadow: 0 14px 32px rgba(37, 211, 102, 0.45), 0 4px 12px rgba(0,0,0,0.22) !important; } /* En mobile, ocultamos el label para que sea solo el ícono y no obstruya */ @media (max-width: 599px) { a[aria-label="Conversar por WhatsApp con Prosperia"] > span { display: none !important; } a[aria-label="Conversar por WhatsApp con Prosperia"] { padding: 14px !important; width: 56px !important; height: 56px !important; justify-content: center !important; } } `; document.head.appendChild(waMQ); window.WhatsAppFab = WhatsAppFab;