'use client' import { useState } from 'react' type FormState = 'idle' | 'loading' | 'success' | 'error' const T = { ink: '#0B1220', inkSoft: 'rgba(11,18,32,0.6)', border: 'rgba(11,18,32,0.12)', orange: '#F2600C', orangeSoft: '#FFF1E6', fontHead: '"Archivo", sans-serif', } export default function ContactFormV2() { 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') } } 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: '46px', padding: '10px 16px', fontFamily: 'inherit', fontSize: '14px', color: T.ink, background: '#fff', border: `1.5px solid ${T.border}`, borderRadius: '12px', transition: 'border-color .15s, box-shadow .15s', boxSizing: 'border-box', outline: 'none', } const labelStyle: React.CSSProperties = { display: 'block', fontSize: '13px', fontWeight: 600, marginBottom: '6px', color: T.ink, } const focusOn = (e: React.FocusEvent) => { e.target.style.borderColor = T.orange e.target.style.boxShadow = `0 0 0 4px ${T.orangeSoft}` } const focusOff = (e: React.FocusEvent) => { e.target.style.borderColor = T.border e.target.style.boxShadow = 'none' } return (
{state === 'error' && (
Bir hata oluştu. Lütfen tekrar deneyin veya{' '} info@ayris.tech adresine yazın.
)}
) }