diff --git a/src/components/contact/Contact.jsx b/src/components/contact/Contact.jsx new file mode 100644 index 0000000..2f1ce05 --- /dev/null +++ b/src/components/contact/Contact.jsx @@ -0,0 +1,96 @@ +import React, { useState, useEffect } from "react"; +import styles from "./Contact.module.css"; + +const Contact = () => { + const [name, setName] = useState(""); + const [email, setEmail] = useState(""); + const [message, setMessage] = useState(""); + const [challengeAnswer, setChallengeAnswer] = useState(""); + const [isHuman, setIsHuman] = useState(false); + const [challenge, setChallenge] = useState({ num1: 0, num2: 0 }); + + useEffect(() => { + generateChallenge(); + }, []); + + const generateChallenge = () => { + const num1 = Math.floor(Math.random() * 10); + const num2 = Math.floor(Math.random() * 10); + setChallenge({ num1, num2 }); + }; + + const checkChallenge = (e) => { + e.preventDefault(); + if (parseInt(challengeAnswer) === challenge.num1 + challenge.num2) { + setIsHuman(true); + } else { + alert("Incorrect answer. Please try again."); + setChallengeAnswer(""); + generateChallenge(); + } + }; + + const handleSubmit = (e) => { + e.preventDefault(); + // Here you would typically handle the form submission, + // such as sending the data to a server or API + console.log("Form submitted:", { name, email, message }); + // Reset form fields after submission + setName(""); + setEmail(""); + setMessage(""); + }; + + return ( +
+
+

Contact Me

+
+
+

Get in Touch

+

Feel free to reach out for collaborations or just a friendly hello

+
+ Location: City, Country +
+
+ Email: your.email@example.com +
+
+ Phone: +1 (123) 456-7890 +
+
+
+ {!isHuman ? ( +
+

To access the contact form, please solve this simple math problem:

+

{`${challenge.num1} + ${challenge.num2} = ?`}

+ setChallengeAnswer(e.target.value)} required /> + +
+ ) : ( +
+
+ + setName(e.target.value)} required /> +
+
+ + setEmail(e.target.value)} required /> +
+
+ + +
+ +
+ )} +
+
+
+
+ ); +}; + +export default Contact; diff --git a/src/components/contact/Contact.module.css b/src/components/contact/Contact.module.css new file mode 100644 index 0000000..59d7f4e --- /dev/null +++ b/src/components/contact/Contact.module.css @@ -0,0 +1,127 @@ +.contact { + padding: 80px 0; + background-color: #f8f9fa; +} + +.container { + max-width: var(--content-width); + margin: 0 auto; + padding: 0 20px; +} + +.title { + font-size: 2.5rem; + text-align: center; + margin-bottom: 40px; + color: #333; +} + +.content { + display: flex; + gap: 40px; +} + +.infoColumn, +.formColumn { + flex: 1; +} + +.infoColumn h3 { + font-size: 1.5rem; + margin-bottom: 20px; + color: #333; +} + +.infoItem { + margin-bottom: 15px; + font-size: 1rem; + color: #666; +} + +.formGroup { + margin-bottom: 20px; +} + +.formGroup label { + display: block; + margin-bottom: 5px; + font-weight: bold; + color: #333; +} + +.formGroup input, +.formGroup textarea { + width: 100%; + padding: 10px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 1rem; +} + +.formGroup textarea { + height: 150px; + resize: vertical; +} + +.submitButton { + background-color: #ff6600; + color: #fff; + border: none; + padding: 12px 24px; + font-size: 1rem; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.submitButton:hover { + background-color: #e55d00; +} + +.challengeForm { + display: flex; + flex-direction: column; + align-items: center; + gap: 15px; +} + +.challengeForm p { + text-align: center; + font-size: 1rem; + color: #333; +} + +.challengeForm input { + width: 100%; + max-width: 200px; + padding: 10px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 1rem; +} + +.challengeForm button { + background-color: #ff6600; + color: #fff; + border: none; + padding: 10px 20px; + font-size: 1rem; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.challengeForm button:hover { + background-color: #e55d00; +} + +@media (max-width: 768px) { + .content { + flex-direction: column; + } + + .infoColumn, + .formColumn { + width: 100%; + } +} diff --git a/version.txt b/version.txt index 0383441..2774f85 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.9.5 \ No newline at end of file +0.10.0 \ No newline at end of file