import { siteConfig } from '@/lib/config' import CONFIG from '../config' import { useRef, useState } from 'react' /** * 留言表单 * @returns */ export const MessageForm = () => { const formRef = useRef() const [success] = useState(false) const [formData, setFormData] = useState({ fullName: '', email: '', phone: '', message: '' }) const handleChange = (e) => { const { name, value } = e.target setFormData(prevState => ({ ...prevState, [name]: value })) } // useEffect(() => { // const form = formRef.current // const handleSubmit = (e) => { // e.preventDefault() // submitComments(formData).then(response => { // console.log('Subscription succeeded:', response) // // 在此处添加成功订阅后的操作 // setSuccess(true) // }) // .catch(error => { // console.error('Subscription failed:', error) // // 在此处添加订阅失败后的操作 // }) // } // form?.addEventListener('submit', handleSubmit) // return () => { // form?.removeEventListener('submit', handleSubmit) // } // }, [submitComments]) return <>

{siteConfig('STARTER_CONTACT_MSG_TITLE', null, CONFIG)}

{/* Success message */} {success &&

{siteConfig('STARTER_CONTACT_MSG_THANKS', null, CONFIG)}

}
}