Skip to content

Commit 30e59b1

Browse files
committed
feat(contact): add new-inquiry reset button on success
1 parent fc90808 commit 30e59b1

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

components/site/contact-form.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ export function ContactForm() {
6363
},
6464
};
6565

66+
function resetForm() {
67+
setProduct("");
68+
setEmail("");
69+
setEmailTouched(false);
70+
setMessage("");
71+
setAgree(false);
72+
setHp("");
73+
setErrors({});
74+
setServerError(null);
75+
setStatus("idle");
76+
}
77+
6678
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
6779
event.preventDefault();
6880
setServerError(null);
@@ -127,6 +139,16 @@ export function ContactForm() {
127139
<p className="mt-2 text-[var(--color-fg-muted)]">
128140
확인 후 회신 드릴게요.
129141
</p>
142+
<div className="mt-6 flex justify-center">
143+
<Button
144+
type="button"
145+
variant="secondary"
146+
size="lg"
147+
onClick={resetForm}
148+
>
149+
새 문의 작성
150+
</Button>
151+
</div>
130152
</div>
131153
);
132154
}

0 commit comments

Comments
 (0)