'use client' import { useState } from 'react' type FormState = 'idle' | 'loading' | 'success' | 'error' const T = { bg: '#f3f2f2', surface: '#eae9e9', text: '#201f1d', divider: 'rgba(32,31,29,0.16)', accent: '#b68235', accentDark: '#7d5411', fontHead: '"Sora", sans-serif', fontBody: '"Inter", sans-serif', radiusMd: '4px', radiusLg: '7px', } 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 (

Talebiniz alındı.

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

) } const inputStyle: React.CSSProperties = { width: '100%', minHeight: '36px', padding: '6px 10px', fontFamily: T.fontBody, fontSize: '14px', color: T.text, background: 'transparent', border: `1px solid ${T.divider}`, borderRadius: T.radiusMd, transition: 'border-color .15s', boxSizing: 'border-box', } const labelStyle: React.CSSProperties = { display: 'block', fontSize: '12px', marginBottom: '5px', color: 'rgba(32,31,29,0.7)', fontFamily: T.fontBody, } return (
{/* Honeypot */}
(e.target.style.borderColor = T.accent)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.accent)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.accent)} onBlur={e => (e.target.style.borderColor = T.divider)} />
(e.target.style.borderColor = T.accent)} 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.
)}
) }