From f3f3217857e4fc3ec89ee8ddec176ce6cfd7003b Mon Sep 17 00:00:00 2001 From: bender Date: Sun, 8 Mar 2026 13:16:33 +0000 Subject: [PATCH] Add src/app/register/page.tsx --- src/app/register/page.tsx | 246 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 src/app/register/page.tsx diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx new file mode 100644 index 0000000..2bca43b --- /dev/null +++ b/src/app/register/page.tsx @@ -0,0 +1,246 @@ +"use client"; + +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarLayoutFloatingOverlay from "@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay"; +import FooterMedia from "@/components/sections/footer/FooterMedia"; +import { useState } from "react"; +import { Input } from "@/components/form/Input"; +import ButtonTextStagger from "@/components/button/ButtonTextStagger/ButtonTextStagger"; +import Link from "next/link"; +import { Mail, Lock, User, Phone } from "lucide-react"; + +export default function RegisterPage() { + const [formData, setFormData] = useState({ + fullName: "", email: "", phone: "", password: "", confirmPassword: ""}); + + const [errors, setErrors] = useState>({}); + const [submitted, setSubmitted] = useState(false); + + const handleChange = (field: string, value: string) => { + setFormData((prev) => ({ ...prev, [field]: value })); + if (errors[field]) { + setErrors((prev) => ({ ...prev, [field]: "" })); + } + }; + + const validateForm = () => { + const newErrors: Record = {}; + + if (!formData.fullName.trim()) { + newErrors.fullName = "Full name is required"; + } + if (!formData.email.trim()) { + newErrors.email = "Email is required"; + } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) { + newErrors.email = "Please enter a valid email"; + } + if (!formData.phone.trim()) { + newErrors.phone = "Phone number is required"; + } + if (!formData.password) { + newErrors.password = "Password is required"; + } else if (formData.password.length < 8) { + newErrors.password = "Password must be at least 8 characters"; + } + if (!formData.confirmPassword) { + newErrors.confirmPassword = "Please confirm your password"; + } else if (formData.password !== formData.confirmPassword) { + newErrors.confirmPassword = "Passwords do not match"; + } + + setErrors(newErrors); + return Object.keys(newErrors).length === 0; + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + if (validateForm()) { + setSubmitted(true); + console.log("Registration submitted:", formData); + setTimeout(() => { + setSubmitted(false); + }, 3000); + } + }; + + const footerColumns = [ + { + title: "Platform", items: [ + { label: "For Buyers", href: "/buyer" }, + { label: "For Sellers", href: "/seller" }, + { label: "How It Works", href: "#" }, + { label: "Pricing", href: "#pricing" }, + ], + }, + { + title: "Support", items: [ + { label: "Help Center", href: "#" }, + { label: "Contact Us", href: "/contact" }, + { label: "FAQ", href: "#faq" }, + { label: "Report Issue", href: "#" }, + ], + }, + { + title: "Company", items: [ + { label: "About Us", href: "/about" }, + { label: "Blog", href: "#" }, + { label: "Careers", href: "#" }, + { label: "Press", href: "#" }, + ], + }, + ]; + + return ( + + + +
+
+
+

Create Account

+

+ Join Agora marketplace today +

+ + {submitted && ( +
+ Registration submitted successfully! +
+ )} + +
+
+ + handleChange("fullName", value)} + required + /> + {errors.fullName && ( +

{errors.fullName}

+ )} +
+ +
+ + handleChange("email", value)} + required + /> + {errors.email && ( +

{errors.email}

+ )} +
+ +
+ + handleChange("phone", value)} + required + /> + {errors.phone && ( +

{errors.phone}

+ )} +
+ +
+ + handleChange("password", value)} + required + /> + {errors.password && ( +

{errors.password}

+ )} +
+ +
+ + handleChange("confirmPassword", value)} + required + /> + {errors.confirmPassword && ( +

+ {errors.confirmPassword} +

+ )} +
+ +
+ +
+
+ +

+ Already have an account?{" "} + + Sign in + +

+
+
+
+ + +
+ ); +} \ No newline at end of file