diff --git a/README.md b/README.md index 2a71af1..e70c85b 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,10 @@ To do: - Add a splash of colour 🤷‍♂️ - Get proper artwork into database. - Modify about page with proper info, info dependendant on what is requested. + + +OTHER NOTES: + +This project uses an email react form that is on the contact form, created by "Chaoo Charles" +https://github.com/chaoocharles/react-email.js +https://www.youtube.com/watch?v=bMq2riFCF90 diff --git a/package-lock.json b/package-lock.json index dc90ab0..70956cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "hello", "version": "0.1.0", "dependencies": { + "@emailjs/browser": "^3.12.1", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -2356,6 +2357,14 @@ "postcss-selector-parser": "^6.0.10" } }, + "node_modules/@emailjs/browser": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-3.12.1.tgz", + "integrity": "sha512-C5nK07CgSCFx3onsuRt/ZaaMvIi0T3SHHanM7fKozjSvbZu+OjHHP9W608fYpic0OavF7yIlfy4+lRDO33JdbA==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@emotion/is-prop-valid": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz", diff --git a/package.json b/package.json index 5805750..68d9002 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@emailjs/browser": "^3.12.1", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", diff --git a/src/components/EmailContactForm.jsx b/src/components/EmailContactForm.jsx new file mode 100644 index 0000000..d7812c5 --- /dev/null +++ b/src/components/EmailContactForm.jsx @@ -0,0 +1,102 @@ + + +import React, { useRef } from "react"; +import emailjs from "@emailjs/browser"; +import styled from "styled-components"; + +const Contact = () => { + const form = useRef(); + + + + const sendEmail = (e) => { + e.preventDefault(); + + emailjs + .sendForm( + "replace with service id", + "replace with template id", + form.current, + "replace with user id" + ) + .then( + (result) => { + console.log(result.text); + console.log("message sent"); + }, + (error) => { + console.log(error.text); + } + ); + }; + + return ( + +
+ + + + + +