/* global React, Field, Button, Icon, Eyebrow, Reveal, useLanguage */ const { useState, useRef } = React; const CONTACT_ENDPOINT = 'https://formsubmit.co/ajax/tainaborgesphoto@outlook.com'; function Contact({ openBooking }) { const { isPortuguese } = useLanguage(); const [form, setForm] = useState({ name: '', email: '', kind: 'portrait', when: '', note: '' }); const [submitted, setSubmitted] = useState(false); const [status, setStatus] = useState('idle'); const [error, setError] = useState(''); const [honey, setHoney] = useState(''); const openedAt = useRef(Date.now()); const kinds = isPortuguese ? [ { id: 'portrait', label: 'ensaio individual' }, { id: 'couple', label: 'casal' }, { id: 'family', label: 'família' }, { id: 'other', label: 'outra ocasião' }, ] : [ { id: 'portrait', label: 'portrait session' }, { id: 'couple', label: 'couples' }, { id: 'family', label: 'family' }, { id: 'other', label: 'something else' }, ]; const submitContact = async (event) => { event.preventDefault(); setError(''); // Very fast submissions and a filled honeypot are almost always bots. if (honey || Date.now() - openedAt.current < 2500) { setStatus('error'); setError('Please wait a moment and try again.'); return; } try { const lastSent = Number(localStorage.getItem('tb-contact-sent') || 0); if (Date.now() - lastSent < 60000) { throw new Error('Please wait one minute before sending another message.'); } setStatus('sending'); const response = await fetch(CONTACT_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify({ name: form.name.trim().slice(0, 100), email: form.email.trim().slice(0, 160), session_type: form.kind, preferred_date: form.when.trim().slice(0, 100), message: form.note.trim().slice(0, 3000), _subject: `New photography enquiry from ${form.name.trim().replace(/[\r\n]+/g, ' ').slice(0, 80)}`, _template: 'table', _honey: honey, }), }); const result = await response.json().catch(() => ({})); if (!response.ok || result.success === false) throw new Error(result.message || 'The message could not be sent.'); localStorage.setItem('tb-contact-sent', String(Date.now())); setStatus('sent'); setSubmitted(true); } catch (err) { setStatus('error'); setError(err.message || 'Something went wrong. Please email me directly.'); } }; return (
{isPortuguese ? 'contato' : 'contact'}

{isPortuguese ? 'vamos conversar' : 'say hi'}.

{isPortuguese ? 'conte um pouco sobre a experiência que você imagina. respondo em até dois dias, normalmente antes.' : 'Tell me about the New York photo session you have in mind. I usually reply within two days.'}

tainaborgesphoto@outlook.com +1 (516) 559-2237 · whatsapp @tainaborgesphoto
{isPortuguese ? 'ou pule o formulário' : 'or skip the form'}

{isPortuguese ? 'agende uma conversa de 20 minutos por vídeo para contar o que você tem em mente.' : 'book a 20-minute video call and we’ll talk through what you have in mind.'}

{submitted ?
{isPortuguese ? 'enviado' : 'sent'}

{isPortuguese ? 'obrigada' : 'thanks'}{form.name ? `, ${form.name.toLowerCase()}` : ''}.

{isPortuguese ? 'recebi sua mensagem. responderei em até dois dias, normalmente antes.' : 'Your message is here. I usually reply within two days.'}

:
{isPortuguese ? 'qual é a ocasião?' : 'what is it for?'}
{kinds.map((k) => { const active = form.kind === k.id; return ( ); })}
setForm((f) => ({ ...f, name: v }))} placeholder={isPortuguese ? 'seu nome' : 'your name'} /> setForm((f) => ({ ...f, email: v }))} placeholder="hello@example.com" type="email" /> setForm((f) => ({ ...f, when: v }))} placeholder={isPortuguese ? 'junho, agosto, 14 de setembro' : 'june, august-ish, sept 14'} />
setForm((f) => ({ ...f, note: v }))} placeholder={isPortuguese ? 'conte sobre as pessoas, o lugar e o clima que você imagina.' : 'tell me about the people, place, and feeling you have in mind.'} rows={5} />
{error &&

{error}

}
{isPortuguese ? 'eu mesma leio cada mensagem' : 'i read every email myself'}
}
); } function ContactLink({ icon, href, external, children }) { return ( {e.currentTarget.style.borderBottomColor = 'var(--taxi)';e.currentTarget.style.color = 'var(--brick)';}} onMouseLeave={(e) => {e.currentTarget.style.borderBottomColor = 'transparent';e.currentTarget.style.color = 'var(--asphalt)';}}> {children} ); } window.Contact = Contact;