Skip to content

Commit

Permalink
Fixed form and added messages of confirmation or error when sending
Browse files Browse the repository at this point in the history
  • Loading branch information
eperezme committed Dec 12, 2023
1 parent ccee0e0 commit ea39b4d
Show file tree
Hide file tree
Showing 100 changed files with 74 additions and 7 deletions.
Binary file added dist/assets/CV-3SMeTjr4.pdf
Binary file not shown.
Binary file added dist/assets/CV-3SMeTjr4.pdf.br
Binary file not shown.
Binary file added dist/assets/box-DnkqqV6E.webp
Binary file not shown.
Binary file added dist/assets/box-ZodVrPiS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/box-ZodVrPiS.png.br
Binary file not shown.
Binary file added dist/assets/box-b-mz38q0.webp
Binary file not shown.
Binary file added dist/assets/box-fOcf86sv.webp
Binary file not shown.
Binary file added dist/assets/box-ho1JC4Kz.webp
Binary file not shown.
Binary file added dist/assets/box-zvpSbTUU.webp
Binary file not shown.
Binary file added dist/assets/diabplot-DB8lvvOp.webp
Binary file not shown.
Binary file added dist/assets/diabplot-SfGbHhIe.webp
Binary file not shown.
Binary file added dist/assets/diabplot-SfGbHhIe.webp.br
Binary file not shown.
Binary file added dist/assets/diabplot-ZLb1ZTZt.webp
Binary file not shown.
Binary file added dist/assets/diabplot-ZLb1ZTZt.webp.br
Binary file not shown.
Binary file added dist/assets/diabplot-mg2dLJNG.webp
Binary file not shown.
Binary file added dist/assets/diabplot-yBz73zi2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/diabplot-yBz73zi2.png.br
Binary file not shown.
Binary file added dist/assets/diabplot-yQUhjAN3.webp
Binary file not shown.
40 changes: 40 additions & 0 deletions dist/assets/index-iBOevf1u.js

Large diffs are not rendered by default.

Binary file added dist/assets/index-iBOevf1u.js.br
Binary file not shown.
6 changes: 6 additions & 0 deletions dist/assets/index-jokBaQeX.css

Large diffs are not rendered by default.

Binary file added dist/assets/index-jokBaQeX.css.br
Binary file not shown.
Binary file added dist/assets/lambda-MCR71dns.webp
Binary file not shown.
Binary file added dist/assets/lambda-MCR71dns.webp.br
Binary file not shown.
Binary file added dist/assets/lambda-VVI-x8Ea.webp
Binary file not shown.
Binary file added dist/assets/lambda-YGnhVCDu.webp
Binary file not shown.
Binary file added dist/assets/lambda-YGnhVCDu.webp.br
Binary file not shown.
Binary file added dist/assets/lambda-_47YiK0I.webp
Binary file not shown.
Binary file added dist/assets/lambda-wJc28X7L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/lambda-wJc28X7L.png.br
Binary file not shown.
Binary file added dist/assets/lambda-yojAWsUX.webp
Binary file not shown.
Binary file added dist/assets/mev-02m5Qhf1.webp
Binary file not shown.
Binary file added dist/assets/mev-EsXNdE5Q.webp
Binary file not shown.
Binary file added dist/assets/mev-JUCX63J9.webp
Binary file not shown.
Binary file added dist/assets/mev-NSMLvM14.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/mev-NSMLvM14.jpg.br
Binary file not shown.
Binary file added dist/assets/mev-XPTPq7-s.webp
Binary file not shown.
Binary file added dist/assets/mev-cm-NNSTe.webp
Binary file not shown.
Binary file added dist/assets/mev-lftmyxlW.webp
Binary file not shown.
Binary file added dist/assets/mev-ll4718Tf.webp
Binary file not shown.
Binary file added dist/assets/mev-pXwoqI5R.webp
Binary file not shown.
Binary file added dist/assets/mev-rS2SITmS.webp
Binary file not shown.
Binary file added dist/assets/mev-rS2SITmS.webp.br
Binary file not shown.
Binary file added dist/assets/mev-tqTCR2n_.webp
Binary file not shown.
Binary file added dist/assets/mev-wtLR14tV.webp
Binary file not shown.
Binary file added dist/assets/mev-yP6zqb47.webp
Binary file not shown.
Binary file added dist/assets/portal-5vgMnd0P.webp
Binary file not shown.
Binary file added dist/assets/portal-5vgMnd0P.webp.br
Binary file not shown.
Binary file added dist/assets/portal-86T-HfaE.webp
Binary file not shown.
Binary file added dist/assets/portal-86T-HfaE.webp.br
Binary file not shown.
Binary file added dist/assets/portal-LqQhnyrk.webp
Binary file not shown.
Binary file added dist/assets/portal-LqQhnyrk.webp.br
Binary file not shown.
Binary file added dist/assets/portal-__rTGbPX.webp
Binary file not shown.
Binary file added dist/assets/portal-__rTGbPX.webp.br
Binary file not shown.
Binary file added dist/assets/portal-qjVJxgU3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/portal-qjVJxgU3.png.br
Binary file not shown.
Binary file added dist/assets/portal-r0_4WzGE.webp
Binary file not shown.
Binary file added dist/assets/portal-r0_4WzGE.webp.br
Binary file not shown.
Binary file added dist/assets/portal-z8XvCI73.webp
Binary file not shown.
Binary file added dist/assets/principal---Xcf0cj.webp
Binary file not shown.
Binary file added dist/assets/principal-BRaehdmU.webp
Binary file not shown.
Binary file added dist/assets/principal-BRaehdmU.webp.br
Binary file not shown.
Binary file added dist/assets/principal-O4Vm3Yx4.webp
Binary file not shown.
Binary file added dist/assets/principal-WJ86Hz4N.webp
Binary file not shown.
Binary file added dist/assets/principal-XBaOSy92.webp
Binary file not shown.
Binary file added dist/assets/principal-XBaOSy92.webp.br
Binary file not shown.
Binary file added dist/assets/principal-gFuqWqAn.webp
Binary file not shown.
Binary file added dist/assets/principal-oSe-CBGj.webp
Binary file not shown.
Binary file added dist/assets/principal-sLte5aCd.webp
Binary file not shown.
Binary file added dist/assets/principal-tY3wyvzb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/principal-tY3wyvzb.png.br
Binary file not shown.
Binary file added dist/assets/principal-vZuUKxTs.webp
Binary file not shown.
Binary file added dist/assets/principal-vq55VJtC.webp
Binary file not shown.
Binary file added dist/assets/principal-wUk3pzc9.webp
Binary file not shown.
Binary file added dist/assets/principal-xP6RHm05.webp
Binary file not shown.
Binary file added dist/assets/surv2-Il9RU6QS.webp
Binary file not shown.
Binary file added dist/assets/surv2-OMen_-dU.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/surv2-OMen_-dU.png.br
Binary file not shown.
Binary file added dist/assets/surv2-WJHvdoB5.webp
Binary file not shown.
Binary file added dist/assets/surv2-d4qEPSPp.webp
Binary file not shown.
Binary file added dist/assets/surv2-d4qEPSPp.webp.br
Binary file not shown.
Binary file added dist/assets/surv2-o0SCHg-A.webp
Binary file not shown.
Binary file added dist/assets/surv2-qLBbXWQI.webp
Binary file not shown.
Binary file added dist/assets/surv2-qLBbXWQI.webp.br
Binary file not shown.
Binary file added dist/assets/wood-4qnF6c8N.webp
Binary file not shown.
Binary file added dist/assets/wood-8j-bBQ3a.webp
Binary file not shown.
Binary file added dist/assets/wood-AiMQXz-X.webp
Binary file not shown.
Binary file added dist/assets/wood-EyGBcRTB.webp
Binary file not shown.
Binary file added dist/assets/wood-Ict-UB-5.webp
Binary file not shown.
Binary file added dist/assets/wood-LLUFGs4r.webp
Binary file not shown.
Binary file added dist/assets/wood-Okh0X-2c.webp
Binary file not shown.
Binary file added dist/assets/wood-YBiEo1AT.webp
Binary file not shown.
Binary file added dist/assets/wood-dufDDxjY.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/wood-dufDDxjY.jpg.br
Binary file not shown.
Binary file added dist/assets/wood-sim1rnk6.webp
Binary file not shown.
Binary file added dist/assets/wood-zyCgRYW1.webp
Binary file not shown.
14 changes: 14 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./src/assets/icons/dna.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Eduard Portfolio</title>
<script type="module" crossorigin src="/assets/index-iBOevf1u.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-jokBaQeX.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
Expand Down
Binary file added dist/index.html.br
Binary file not shown.
Binary file added dist/vite.svg.br
Binary file not shown.
21 changes: 14 additions & 7 deletions src/sources/contact/Form.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import emailjs from '@emailjs/browser';

const Form = () => {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const [subject, setSubject] = useState('');
const [message, setMessage] = useState('');
const [isFormValid, setIsFormValid] = useState(false);
const [errorMessage, setErrorMessage] = useState('');

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

if (message.trim() === '') {
return; // Do not send the message if it is empty
if (!isFormValid) {
const errorMessage = 'Please fill in all fields.'; // Set error message if any field is empty
setErrorMessage(errorMessage); // Update the state
alert(errorMessage); // Display error message in a popup alert
return;
}

// Replace with your own emailjs service ID, template ID, and public key
Expand All @@ -27,21 +32,24 @@ const Form = () => {
}, publicKey)
.then((response) => {
console.log('Email sent successfully!', response.status, response.text);
// Reset form fields
// Reset form fields and error message
setName('');
setEmail('');
setSubject('');
setMessage('');
alert('Email sent successfully!');
})
.catch((error) => {
console.error('Error sending email:', error);
});
};

return (
useEffect(() => {
setIsFormValid(name.trim() !== '' && email.trim() !== '' && subject.trim() !== '' && message.trim() !== '');
}, [name, email, subject, message]);

return (
<form onSubmit={handleSubmit} className="col-md-11 col-lg-9">

<div className="form-group">
<label className='form'>
<h4>Name</h4>
Expand Down Expand Up @@ -70,7 +78,6 @@ const Form = () => {
</label>
</div>


<div className="d-flex flex-column flex-md-row mt-3 pb-2">
<button type="submit" className="btn-mktg">Submit
<svg xmlns="http://www.w3.org/2000/svg" className="octicon arrow-symbol-mktg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path className="octicon-chevrow-stem" stroke="currentColor" d="M1.75 8H11" strokeWidth="1.5" strokeLinecap="round"></path></svg>
Expand Down

0 comments on commit ea39b4d

Please sign in to comment.