diff --git a/app/login/page.tsx b/app/login/page.tsx new file mode 100644 index 0000000..0c790d4 --- /dev/null +++ b/app/login/page.tsx @@ -0,0 +1,363 @@ +"use client"; + +import React, { useState, ChangeEvent, FormEvent } from 'react'; +import * as z from "zod"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; + +// Define the form schema using zod +const formSchema = z.object({ + name: z.string().nonempty("*Name is required"), + email: z.string().email("*Invalid email address"), + password: z.string().min(6, "*Password should be at least 6 characters"), +}); + +// Contact form component +export default function SignInSignUp() { + const [type, setType] = useState('signIn'); + const [isSubmitted, setIsSubmitted] = useState(false); + + const signInForm = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + email: "", + password: "" + } + }); + + const signUpForm = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + name: "", + email: "", + password: "" + } + }); + + // Handle form submission + const handleSignInSubmit = (values: z.infer) => { + console.log("Sign In:", values); + // Handle form submission (e.g., send data to the server) + setIsSubmitted(true); + signInForm.reset(); + setTimeout(() => setIsSubmitted(false), 3000); // Hide notification after 3 seconds + }; + + const handleSignUpSubmit = (values: z.infer) => { + console.log("Sign Up:", values); + // Handle form submission (e.g., send data to the server) + setIsSubmitted(true); + signUpForm.reset(); + setTimeout(() => setIsSubmitted(false), 3000); // Hide notification after 3 seconds + }; + + const handleOnClick = (text: string) => { + if (text !== type) { + setType(text); + } + }; + + const containerClass = `container ${type === 'signUp' ? 'right-panel-active' : ''}`; + + return ( +
+ +
+
+
+

Create Account

+
+ + + +
+ or use your email for registration + + {signUpForm.formState.errors.name && ( +

{signUpForm.formState.errors.name?.message}

+ )} + + {signUpForm.formState.errors.email && ( +

{signUpForm.formState.errors.email?.message}

+ )} + + {signUpForm.formState.errors.password && ( +

{signUpForm.formState.errors.password?.message}

+ )} + +
+
+
+
+

Access your Account

+
+ + + +
+ or Proceed with Your Profile + + {signInForm.formState.errors.email && ( +

{signInForm.formState.errors.email?.message}

+ )} + + {signInForm.formState.errors.password && ( +

{signInForm.formState.errors.password?.message}

+ )} + Forgot your password? + +
+
+
+
+
+

Welcome Back!

+

To keep connected with us please login with your personal info

+ +
+
+

Welcome aboard!

+

Share a bit about yourself and let's embark on a journey together filled with discovery and excitement.

+ +
+
+
+
+ {isSubmitted && ( +

Form submitted successfully!

+ )} +
+ ); +} diff --git a/components/Login.tsx b/components/Login.tsx new file mode 100644 index 0000000..3314305 --- /dev/null +++ b/components/Login.tsx @@ -0,0 +1,16 @@ +"use client" +import { useRouter } from "next/navigation"; + +export default function Login() { + const router = useRouter(); + + const handleNavigation = () => { + router.push('/login'); + }; + + return ( + + ); +} diff --git a/components/Nav.tsx b/components/Nav.tsx index 47d9ecd..4de4357 100644 --- a/components/Nav.tsx +++ b/components/Nav.tsx @@ -7,8 +7,10 @@ import { } from "flowbite-react"; import Social from "./Social"; import Contact from "./Contact"; +import Login from "./Login"; import About from "./About"; + export function Nav() { return ( + diff --git a/package-lock.json b/package-lock.json index 1b5dbc0..ec7fcec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "temp", "version": "0.1.0", "dependencies": { + "@fortawesome/fontawesome-free": "^6.5.2", "@hookform/resolvers": "^3.5.0", "@tsparticles/engine": "^3.4.0", "@tsparticles/react": "^3.0.0", @@ -135,6 +136,15 @@ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" }, + "node_modules/@fortawesome/fontawesome-free": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.5.2.tgz", + "integrity": "sha512-hRILoInAx8GNT5IMkrtIt9blOdrqHOnPBH+k70aWUAqPZPgopb9G5EQJFpaBx/S8zp2fC+mPW349Bziuk1o28Q==", + "hasInstallScript": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@hookform/resolvers": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.5.0.tgz", diff --git a/package.json b/package.json index ad7492b..1a0ed57 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dev:docker": "next dev" }, "dependencies": { + "@fortawesome/fontawesome-free": "^6.5.2", "@hookform/resolvers": "^3.5.0", "@tsparticles/engine": "^3.4.0", "@tsparticles/react": "^3.0.0",