diff --git a/app/components/ContactForm.tsx b/app/components/ContactForm.tsx deleted file mode 100644 index 905b3b0..0000000 --- a/app/components/ContactForm.tsx +++ /dev/null @@ -1,184 +0,0 @@ -'use client'; - -import { useState, useEffect, Suspense } from 'react'; -import { useSearchParams } from 'next/navigation'; -import { trackEvent } from '../../lib/gtag'; - -function ContactFormInner() { - const searchParams = useSearchParams(); - const [formData, setFormData] = useState({ - name: '', - phone: '', - email: '', - service: '외주 개발 문의', - message: '', - }); - const [status, setStatus] = useState<'idle' | 'loading' | 'success' | 'error'>('idle'); - const [errorMessage, setErrorMessage] = useState(''); - - useEffect(() => { - const serviceParam = searchParams.get('service'); - if (serviceParam) { - setFormData((prev) => ({ ...prev, service: serviceParam })); - } - }, [searchParams]); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - setStatus('loading'); - setErrorMessage(''); - - try { - const response = await fetch('/api/contact', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(formData), - }); - const data = await response.json(); - if (!response.ok) throw new Error(data.error || '문의 전송에 실패했습니다.'); - setStatus('success'); - trackEvent('generate_lead', { - event_category: 'contact', - event_label: formData.service, - }); - setFormData({ name: '', phone: '', email: '', service: '외주 개발 문의', message: '' }); - setTimeout(() => setStatus('idle'), 5000); - } catch (error) { - setStatus('error'); - setErrorMessage(error instanceof Error ? error.message : '문의 전송에 실패했습니다.'); - } - }; - - const handleChange = ( - e: React.ChangeEvent - ) => { - setFormData((prev) => ({ ...prev, [e.target.name]: e.target.value })); - }; - - const fieldClass = - 'w-full px-3.5 py-2.5 text-sm border rounded-xl outline-none bg-white disabled:bg-slate-50 transition-colors focus:ring-2 focus:ring-[var(--jsm-accent)] focus:border-[var(--jsm-accent)]'; - - return ( -
-
-
- - -
-
- - -
-
- -
- - -
- -
- - -
- -
- -