Skip to content

Commit

Permalink
improved form disable states
Browse files Browse the repository at this point in the history
  • Loading branch information
sanidhyy authored Jan 12, 2024
1 parent 2c74d25 commit f4adbdf
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/components/Contact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Contact = () => {
to_email: import.meta.env.VITE_APP_EMAILJS_RECIEVER,
message: form.message,
},
import.meta.env.VITE_APP_EMAILJS_KEY,
import.meta.env.VITE_APP_EMAILJS_KEY
)
.then(
() => {
Expand All @@ -117,7 +117,7 @@ const Contact = () => {
email: "",
message: "",
});
},
}
);
};

Expand Down Expand Up @@ -148,7 +148,9 @@ const Contact = () => {
onChange={handleChange}
placeholder="John Doe"
title="What's your name?"
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium"
disabled={loading}
aria-disabled={loading}
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium disabled:bg-tertiary/20 disabled:text-white/60"
/>

{/* Invalid Name */}
Expand All @@ -168,7 +170,9 @@ const Contact = () => {
onChange={handleChange}
placeholder="[email protected]"
title="What's your email?"
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium"
disabled={loading}
aria-disabled={loading}
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium disabled:bg-tertiary/20 disabled:text-white/60"
/>

{/* Invalid Email */}
Expand All @@ -189,7 +193,9 @@ const Contact = () => {
onChange={handleChange}
placeholder="Hello there!"
title="What do you want to say?"
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium"
disabled={loading}
aria-disabled={loading}
className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium disabled:bg-tertiary/20 disabled:text-white/60 disabled:resize-none"
/>

{/* Invalid Message */}
Expand All @@ -202,8 +208,9 @@ const Contact = () => {
<button
type="submit"
title={loading ? "Sending..." : "Send"}
className="bg-tertiary py-3 px-8 outline-none w-fit text-white font-bold shadow-md shadow-primary rounded-xl"
className="bg-tertiary py-3 px-8 outline-none w-fit text-white font-bold shadow-md shadow-primary rounded-xl disabled:bg-tertiary/20 disabled:text-white/60"
disabled={loading}
aria-disabled={loading}
>
{/* check loader state */}
{loading ? "Sending..." : "Send"}
Expand Down

0 comments on commit f4adbdf

Please sign in to comment.