Skip to content

Commit

Permalink
update contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag270102 committed Mar 8, 2024
1 parent 9d63ad9 commit c51efd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link href="https://fonts.googleapis.com/css?family=Russo+One" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
10 changes: 6 additions & 4 deletions src/component/contact/Contact.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { useRef } from 'react';
import { useRef, useState } from 'react';
import emailjs from '@emailjs/browser';
const Contact = () => {
const form = useRef();

const [submit,setsubmit]=useState('Send');
const sendEmail = (e) => {
e.preventDefault();
emailjs.sendForm(import.meta.env.VITE_APP_SERVICE, import.meta.env.VITE_APP_TEMP, form.current, import.meta.env.VITE_APP_KEY)
.then((result) => {
console.log(result.text);
setsubmit('Sent');
}, (error) => {
console.log(error.text);
});

};
return (
<div>
Expand All @@ -33,9 +35,9 @@ const Contact = () => {
<label htmlFor="message" className="block text-gray-700 text-sm font-bold mb-2">Message</label>
<textarea name="message" id="message" required className="w-full px-3 py-2 border rounded focus:outline-none focus:border-blue-500"></textarea>
</div>
<button type="submit" className="w-full bg-[#fff] text-black hover:text-gray-200 font-sen font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline-blue">
<button type="submit" className="w-full bg-[#fff] text-black hover:text-gray-600 font-sen font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline-blue">
<div className='flex justify-center items-center gap-10'>
Send
{submit}
<img src="/assets/icons8-sent.gif" alt="" className='w-[20px]'/>
</div>
</button>
Expand Down

0 comments on commit c51efd7

Please sign in to comment.