checkpoint: before i18n implementation
This commit is contained in:
+27
-26
@@ -6,14 +6,14 @@ import { z } from "zod"
|
||||
import { useState } from "react"
|
||||
|
||||
const schema = z.object({
|
||||
firstName: z.string().min(1, "First name is required"),
|
||||
lastName: z.string().min(1, "Last name is required"),
|
||||
email: z.string().email("Please enter a valid email"),
|
||||
country: z.string().min(1, "Country is required"),
|
||||
phone: z.string().min(1, "Phone number is required"),
|
||||
company: z.string().min(1, "Company is required"),
|
||||
companySize: z.string().min(1, "Please select company size"),
|
||||
message: z.string().min(10, "Message must be at least 10 characters"),
|
||||
firstName: z.string().min(1, "请填写名字"),
|
||||
lastName: z.string().min(1, "请填写姓氏"),
|
||||
email: z.string().email("请输入有效的邮箱地址"),
|
||||
country: z.string().min(1, "请填写所在国家或地区"),
|
||||
phone: z.string().min(1, "请填写联系方式"),
|
||||
company: z.string().min(1, "请填写公司或项目名称"),
|
||||
companySize: z.string().min(1, "请选择团队规模"),
|
||||
message: z.string().min(10, "请至少写 10 个字符说明你的需求"),
|
||||
})
|
||||
|
||||
type FormData = z.infer<typeof schema>
|
||||
@@ -43,15 +43,15 @@ export default function ContactForm() {
|
||||
|
||||
if (status === "success") {
|
||||
return (
|
||||
<div className="contact-form-block w-form">
|
||||
<div id="contact-form" className="contact-form-block w-form">
|
||||
<div className="success-message-wrapper w-form-done" style={{ display: "block" }}>
|
||||
<div className="contact-success-message">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 20 20" fill="none" className="contact-success-icon">
|
||||
<path d="M7.20658 10.9311L9.24116 12.1209L12.7928 7.20696M1 10C1 5.02944 5.02944 1 10 1C14.9706 1 19 5.02944 19 10C19 14.9706 14.9706 19 10 19C5.02944 19 1 14.9706 1 10Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="square" />
|
||||
</svg>
|
||||
<h2 className="display-5">Thank you! We'll get back to you soon</h2>
|
||||
<h2 className="display-5">已收到你的信息,我们会尽快联系你</h2>
|
||||
<div className="mg-top-4x-extra-small">
|
||||
<p>We have received your message and will get back to you as soon as possible.</p>
|
||||
<p>如果你在消息里写了团队规模、代码栈和交付约束,后续沟通会更快进入正题。</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,20 +60,21 @@ export default function ContactForm() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="contact-form-block w-form">
|
||||
<div id="contact-form" className="contact-form-block w-form">
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="grid-2-columns contact-form-grid">
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="First name" type="text" {...register("firstName")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="Last name" type="text" {...register("lastName")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="Email address" type="email" {...register("email")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="Country" type="text" {...register("country")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="(123) 456 - 7890" type="tel" {...register("phone")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="Company" type="text" {...register("company")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="名字" type="text" {...register("firstName")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="姓氏" type="text" {...register("lastName")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="工作邮箱" type="email" {...register("email")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="所在国家 / 地区" type="text" {...register("country")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="微信 / 电话" type="tel" {...register("phone")} />
|
||||
<input className={`input contact-form w-input`} maxLength={256} placeholder="公司 / 项目名称" type="text" {...register("company")} />
|
||||
<div className="select-wrapper">
|
||||
<select className="input select-form w-select" {...register("companySize")}>
|
||||
<option value="">Company size</option>
|
||||
<option value="1-20 Employees">1-20 Employees</option>
|
||||
<option value="20-100 Employees">20-100 Employees</option>
|
||||
<option value="100+ Employees">100+ Employees</option>
|
||||
<option value="">团队规模</option>
|
||||
<option value="1-10">1-10 人</option>
|
||||
<option value="11-50">11-50 人</option>
|
||||
<option value="51-200">51-200 人</option>
|
||||
<option value="200+">200 人以上</option>
|
||||
</select>
|
||||
<div className="select-icon-wrapper">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 20 20" fill="none" className="select-icon">
|
||||
@@ -81,21 +82,21 @@ export default function ContactForm() {
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<textarea maxLength={5000} placeholder="Enter your message" className="text-area contact-form w-input" {...register("message")} />
|
||||
<textarea maxLength={5000} placeholder="介绍你的团队、当前流程、想解决的问题,以及希望 DAL Code 帮你完成什么。" className="text-area contact-form w-input" {...register("message")} />
|
||||
<div className="contact-form-button-wrapper">
|
||||
<button type="submit" className="form-button w-button" disabled={isSubmitting}>
|
||||
{isSubmitting ? "Please wait..." : "Send message"}
|
||||
{isSubmitting ? "提交中..." : "提交需求"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{Object.keys(errors).length > 0 && (
|
||||
<div className="error-message contact-form-error w-form-fail" style={{ display: "block" }}>
|
||||
<div>Please fill in all required fields correctly.</div>
|
||||
<div>请先完整填写必填项,并确认邮箱格式正确。</div>
|
||||
</div>
|
||||
)}
|
||||
{status === "error" && (
|
||||
<div className="error-message contact-form-error w-form-fail" style={{ display: "block" }}>
|
||||
<div>Oops! Something went wrong. Please try again.</div>
|
||||
<div>提交失败,请稍后重试。</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user