'use client' import { useState } from 'react' type FormState = 'idle' | 'loading' | 'success' | 'error' const T = { bg: '#F4F4F0', ink: '#0A0A0A', inkSoft: 'rgba(10,10,10,0.6)', divider: 'rgba(10,10,10,0.16)', red: '#E61919', fontHead: '"Archivo", sans-serif', fontMono: '"JetBrains Mono", monospace', } export default function ContactForm() { const [state, setState] = useState('idle') const [form, setForm] = useState({ name: '', org: '', email: '', phone: '', _hp: '' }) const set = (k: keyof typeof form) => (e: React.ChangeEvent) => setForm(p => ({ ...p, [k]: e.target.value })) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (form._hp) return setState('loading') try { const res = await fetch('/api/contact', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: form.name, email: form.email, barNo: form.org, message: form.phone }), }) setState(res.ok ? 'success' : 'error') } catch { setState('error') } } /* Success */ if (state === 'success') { return (
STATUS: RECEIVED

Talebiniz alındı.

Kurucu ekipten kısa süre içinde size dönüş yapılacak.

) } const inputStyle: React.CSSProperties = { width: '100%', minHeight: '40px', padding: '8px 12px', fontFamily: T.fontMono, fontSize: '13.5px', color: T.ink, background: '#fff', border: `2px solid ${T.divider}`, transition: 'border-color .12s', boxSizing: 'border-box', } const labelStyle: React.CSSProperties = { display: 'block', fontSize: '10.5px', letterSpacing: '0.1em', textTransform: 'uppercase', marginBottom: '6px', color: T.inkSoft, fontFamily: T.fontMono, fontWeight: 600, } return (
{/* Honeypot */}
(e.target.style.borderColor = T.red)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.red)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.red)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.red)} onBlur={e => (e.target.style.borderColor = T.divider)} />
{state === 'error' && (
Bir hata oluştu. Lütfen tekrar deneyin veya{' '} info@ayris.tech adresine yazın.
)}
) }