Skip to content

Commit

Permalink
Fix: remove netlify form handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Infamous-GEEK committed Nov 28, 2022
1 parent 272d6cb commit 6b6d94d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 0 additions & 6 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@

<body>
<div id="root"></div>
<!-- A little help for the Netlify post-processing bots -->
<form name="contact" netlify netlify-honeypot="bot-field" hidden>
<input type="text" name="name" />
<input type="email" name="email" />
<textarea name="message"></textarea>
</form>

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WMKK9NG" height="0" width="0"
Expand Down
22 changes: 16 additions & 6 deletions src/Components/contacts/Contacts.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import React from 'react'
import './contacts.css'

import { useRef } from 'react';
import emailjs from 'emailjs-com';

const Contacts = () => {

const form = useRef();

const sendEmail = (e) => {
e.preventDefault();

emailjs.sendForm('service_krmscgo', 'template_u1j0oi9', form.current, '-cMRTG1WsoDkBLn6F')
.then((result) => {
console.log(result.text);
}, (error) => {
console.log(error.text);
});
e.target.reset()
};

return (
<section id='contacts'>
Expand All @@ -13,11 +27,7 @@ const Contacts = () => {
</div>

<div className="container contacts__container">
<form method="post">
{/*TO ASSIST NETLIFY BOTS*/}
<input type="hidden" name="Portifolio contact form" value="contact" />
{/*TO ASSIST NETLIFY BOTS*/}

<form ref={form} onSubmit={sendEmail}>
<input type="text" name="name" placeholder="Your Full Name" required />
<input type="email" name="email" placeholder="Your E-MAIL" required />
<textarea name="message" rows="7" placeholder='Your Message' required ></textarea>
Expand Down

0 comments on commit 6b6d94d

Please sign in to comment.