-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,9 @@ export const sendEmail = async (formData: FormData) =>{ | |
error: "Invalid Message" | ||
} | ||
} | ||
|
||
let data; | ||
try { | ||
await resend.emails.send({ | ||
data = await resend.emails.send({ | ||
from: 'Contact Form <[email protected]>', | ||
to: '[email protected]', | ||
subject: "Message from contact form", | ||
|
@@ -39,5 +39,9 @@ export const sendEmail = async (formData: FormData) =>{ | |
}; | ||
} | ||
|
||
return { | ||
data | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react' | ||
import { experimental_useFormStatus as useFormStatus } from 'react-dom'; | ||
import { FaPaperPlane } from 'react-icons/fa'; | ||
export default function SubmitBtn() { | ||
const { pending } = useFormStatus(); | ||
|
||
return ( | ||
<button | ||
type="submit" | ||
className="group flex items-center justify-center gap-2 h-[3rem] w-[8rem] bg-gray-900 text-white rounded-full outline-none transition-all focus:scale-110 hover:scale-110 hover:bg-gray-950 active:scale-105 disabled:scale-100 disabled:bg-opacity-65" | ||
disabled={pending} | ||
> | ||
{pending ? ( | ||
<div className="h-5 w-5 animate-spin rounded-full border-b-2 border-white"></div> | ||
) : ( | ||
<> | ||
Submit{" "} | ||
<FaPaperPlane className="text-xs opacity-70 transition-all group-hover:translate-x-1 group-hover:-translate-y-1" />{" "} | ||
</> | ||
)} | ||
</button> | ||
); | ||
} |