From d0aedc43abd9b5cf3ec2bf87c26051c49d22c60d Mon Sep 17 00:00:00 2001
From: Amruta Kothawade <116087736+Amruta7203@users.noreply.github.com>
Date: Sun, 26 May 2024 18:42:22 +0530
Subject: [PATCH 01/11] Corrected spelling error
---
src/components/UI/Exercises.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/UI/Exercises.jsx b/src/components/UI/Exercises.jsx
index 7abdeca3..20a17e77 100644
--- a/src/components/UI/Exercises.jsx
+++ b/src/components/UI/Exercises.jsx
@@ -10,7 +10,7 @@ const Exercises = () => {
- Benifits of Exercise
+ Benefits of Exercise
You'll discover the transformative power it holds in shaping a life
From d4ef6513a687b627899b46170c08edb2a148ff18 Mon Sep 17 00:00:00 2001
From: kesharwaniyanshi
Date: Thu, 30 May 2024 14:03:56 +0530
Subject: [PATCH 02/11] Added Registration page
---
src/App.jsx | 4 +-
src/components/Header/Header.jsx | 6 +-
src/components/UI/Register.jsx | 142 +++++++++++++++++++++++++++++
src/styles/register.css | 150 +++++++++++++++++++++++++++++++
4 files changed, 297 insertions(+), 5 deletions(-)
create mode 100644 src/components/UI/Register.jsx
create mode 100644 src/styles/register.css
diff --git a/src/App.jsx b/src/App.jsx
index fea06856..d72cab10 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -13,7 +13,8 @@ import BackToTop from "./components/UI/BackToTop";
import LocomotiveScroll from 'locomotive-scroll';
import Classes from "./components/UI/Classes";
import Diet from "./components/UI/Diet";
-import { BrowserRouter as Router , Routes, Route } from "react-router-dom";
+import Register from "./components/UI/Register";
+import { BrowserRouter as Router , Routes, Route } from "reacts-router-dom";
@@ -47,6 +48,7 @@ function App() {
} />
} />
} />
+
} />
>
diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx
index 96e596b9..2a32822a 100644
--- a/src/components/Header/Header.jsx
+++ b/src/components/Header/Header.jsx
@@ -4,6 +4,7 @@ import logo from "../../assets/img/dumble.png";
import { useEffect, useState } from "react";
import gsap from "gsap";
import { useGSAP } from "@gsap/react";
+import { Link } from "react-router-dom";
gsap.registerPlugin(useGSAP);
const nav__links = [
@@ -160,10 +161,7 @@ const Header = ({ isDarkMode, setDarkMode }) => {
{/* Nav Right */}
-
- {/*
-
- */}
+
diff --git a/src/components/UI/Register.jsx b/src/components/UI/Register.jsx
new file mode 100644
index 00000000..cd6859ce
--- /dev/null
+++ b/src/components/UI/Register.jsx
@@ -0,0 +1,142 @@
+import React, { useState } from "react";
+import toast, { Toaster } from "react-hot-toast";
+import "../../styles/register.css";
+import Lottie from "lottie-react";
+import ContactAnimation from "../../assets/JSON/contactus.json";
+
+const Register = () => {
+ const initialFormData={
+ name: "",
+ email: "",
+ age: "",
+ contact: "",
+ password: "",
+ };
+ const [formData, setFormData] = useState(initialFormData);
+
+ const validateForm = () => {
+ if (formData.name === "" || formData.name === null) {
+ toast.error("Please enter your name");
+ return false;
+ } else if (formData.email === "" || formData.email === null) {
+ toast.error("Please enter your email");
+ return false;
+ } else if (!isValidEmail(formData.email)) {
+ toast.error("Please enter a valid email");
+ return false;
+ } else if (formData.age === "" || formData.age === null) {
+ toast.error("Please provide your age");
+ return false;
+ } else if (formData.contact === "" || formData.contact === null) {
+ toast.error("Please provide your phone number");
+ return false;
+ } else if (isNaN(formData.contact)) {
+ toast.error("Please enter a valid phone number");
+ return false;
+ } else if (formData.password === "" || formData.password === null) {
+ toast.error("Please enter a password");
+ return false;
+ } else if (!isValidPassword(formData.password)) {
+ toast.error("Please enter a valid password");
+ return false;
+ } else {
+ return true;
+ }
+ };
+
+ const isValidEmail = (email) => {
+ const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
+ return emailPattern.test(email);
+ };
+
+ const isValidPassword = (password) => {
+ const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/;
+ return passwordPattern.test(password);
+ };
+
+ const handleSubmit = (e) => {
+ e.preventDefault();
+ if (validateForm()) {
+ toast.success("Registered successfully", {
+ duration: 3000, // Duration in milliseconds (3 seconds)
+ position: "top-center",
+ }
+ );
+ console.log("Form data:", formData);
+ setFormData(initialFormData);
+ }
+ };
+
+ const handleInputChange = (e) => {
+ const { name, value } = e.target;
+ setFormData({ ...formData, [name]: value });
+ };
+
+ return (
+