48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import Link from 'next/link';
|
|
import { useLanguage } from '@/contexts/LanguageContext';
|
|
import { useState, useEffect } from 'react';
|
|
|
|
export default function WhatsAppButton() {
|
|
const { t } = useLanguage();
|
|
const [whatsappLink, setWhatsappLink] = useState('https://api.whatsapp.com/send/?phone=553598829445&text&type=phone_number&app_absent=0');
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
|
|
// Usa o número padrão correto
|
|
// Se precisar atualizar no futuro, mude aqui
|
|
const defaultNumber = '553598829445';
|
|
setWhatsappLink(`https://api.whatsapp.com/send/?phone=${defaultNumber}&text&type=phone_number&app_absent=0`);
|
|
}, []);
|
|
|
|
if (!mounted) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Link
|
|
href={whatsappLink}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="fixed bottom-6 right-6 z-40 bg-[#25D366] text-white w-14 h-14 rounded-full shadow-lg hover:shadow-xl transition-shadow duration-200 flex items-center justify-center flex-shrink-0"
|
|
aria-label={t('whatsapp.label')}
|
|
style={{
|
|
transition: 'all 0.2s ease-in-out',
|
|
}}
|
|
onMouseEnter={(e) => {
|
|
e.currentTarget.style.backgroundColor = '#20bd5a';
|
|
e.currentTarget.style.transform = 'scale(1.1)';
|
|
}}
|
|
onMouseLeave={(e) => {
|
|
e.currentTarget.style.backgroundColor = '#25D366';
|
|
e.currentTarget.style.transform = 'scale(1)';
|
|
}}
|
|
>
|
|
<i className="ri-whatsapp-line text-3xl leading-none"></i>
|
|
</Link>
|
|
);
|
|
}
|