Skip to content

Commit 452b3d3

Browse files
committed
Prevent forms from default reload
1 parent 92d4f53 commit 452b3d3

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/components/ContactForm.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ const ContactForm = () => {
22
return (
33
<div className="w-full sm:w-1/2">
44
<div className="leading-loose">
5-
<form className="max-w-xl m-4 p-6 sm:p-10 bg-secondary-light dark:bg-secondary-dark rounded-xl shadow-xl text-left">
5+
<form
6+
onSubmit={(e) => {
7+
e.preventDefault();
8+
}}
9+
className="max-w-xl m-4 p-6 sm:p-10 bg-secondary-light dark:bg-secondary-dark rounded-xl shadow-xl text-left"
10+
>
611
<p className="text-primary-dark dark:text-primary-light text-2xl font-semibold mb-8">
712
Contact Form
813
</p>

src/components/HireMeModal.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ const HireMeModal = ({ onClose, onRequest }) => {
2222
</button>
2323
</div>
2424
<div className="modal-body p-5 w-full h-full">
25-
<form className="max-w-xl m-4 text-left">
25+
<form
26+
onSubmit={(e) => {
27+
e.preventDefault();
28+
}}
29+
className="max-w-xl m-4 text-left"
30+
>
2631
<div className="">
2732
<input
2833
className="w-full px-5 py-2 border dark:border-secondary-dark rounded-lg text-md dark:font-medium bg-secondary-light dark:bg-ternary-dark text-primary-dark dark:text-ternary-light"
@@ -73,6 +78,7 @@ const HireMeModal = ({ onClose, onRequest }) => {
7378
<div className="mt-6 pb-4 sm:pb-1">
7479
<button
7580
onClick={onRequest}
81+
type="submit"
7682
className="px-4
7783
sm:px-6
7884
py-2

0 commit comments

Comments
 (0)