Skip to content

Commit

Permalink
profile form
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-dev-395 committed May 26, 2024
1 parent 1407836 commit 3b6cc42
Show file tree
Hide file tree
Showing 7 changed files with 287 additions and 23 deletions.
8 changes: 6 additions & 2 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"
import Login from "./components/user/Login.jsx"
import Login from "./components/user/registration/Login.jsx"
import Navbar from "./components/navbar/Navbar.jsx"
import Footer from "./components/footer/Footer.jsx"
import Register from "./components/user/Register.jsx"
import Register from "./components/user/registration/Register.jsx"
import Profile from "./components/profile/Profile.jsx"
import UserDetails from "./components/user/userDetails.jsx/UserDetails.jsx"
import VerifyDocs from "./components/user/verification/VerifyDocs.jsx"

const App = () => {
return (
Expand All @@ -14,6 +16,8 @@ const App = () => {
<Route element={<Login />} path="/login" />
<Route element={<Register />} path="/register" />
<Route element={<Profile />} path="/user/profile" />
<Route element={<UserDetails />} path="/registration/user/details" />
<Route element={<VerifyDocs />} path="/registration/user/VerifyDocs" />
</Routes>
<Footer />
</BrowserRouter>
Expand Down
43 changes: 24 additions & 19 deletions client/src/components/navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { useState } from "react";
import { FaBars, FaTimes } from "react-icons/fa";
const logoImg = "/public/img/RISHTA.png";

const navItems = [
{ to: "/", label: "Home", className: "text-white hover:text-gray-400" },
{ to: "/about", label: "About", className: "text-white hover:text-gray-400" },
{ to: "/contact", label: "Contact", className: "text-white hover:text-gray-400" },
{ to: "/partner", label: "Partner", className: "text-white hover:text-gray-400" },
{ to: "/login", label: "Login", className: "bg-white text-black rounded-2xl hover:bg-gray-300" },
];

const Navbar = () => {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);

Expand All @@ -11,37 +19,34 @@ const Navbar = () => {
};

return (
<header className="w-full h-20 bg-black text-white fixed top-0 left-0 z-50 ">
<header className="w-full h-20 bg-black text-white fixed top-0 left-0 z-50">
<nav className="flex justify-between items-center md:max-w-4xl max-w-60 mx-auto py-3 px-4 md:px-0">
<Link to="/">
<img src={logoImg} className="w-16 h-16 rounded-full" alt="logo image" />
<img src={logoImg} className="w-16 h-16 rounded-full" alt="logo" />
</Link>

<ul className={`md:flex gap-9 ${isMobileMenuOpen ? "flex flex-col items-center bg-black" : "hidden"} md:items-center md:static absolute top-20 left-0 w-full bg-black md:bg-transparent md:flex-row flex-col items-center md:w-auto transition-transform duration-300`}>
<li className="my-2 md:my-0">
<Link to="/" className="block py-2 px-4 text-white hover:text-gray-400">Home</Link>
</li>
<li className="my-2 md:my-0">
<Link to="/about" className="block py-2 px-4 text-white hover:text-gray-400">About</Link>
</li>
<li className="my-2 md:my-0">
<Link to="/contact" className="block py-2 px-4 text-white hover:text-gray-400">Contact</Link>
</li>
<li className="my-2 md:my-0">
<Link to="/partner" className="block py-2 px-4 text-white hover:text-gray-400">Partner</Link>
</li>
<li className="my-2 md:my-0">
<Link to="/login" className="block py-2 px-4 bg-white text-black rounded-2xl hover:bg-gray-300">Login</Link>
{navItems.map((item, index) => (
<li key={index} className="my-2 md:my-0">
<Link to={item.to} className={`block py-2 px-4 ${item.className}`}>
{item.label}
</Link>
</li>

))}

<li className="">
<Link to="/user/profile" className=" bg-white text-black rounded-2xl hover:bg-gray-300">
<img src="https://images.unsplash.com/photo-1715638427009-8b0fe7096838?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzMHx8fGVufDB8fHx8fA%3D%3D" alt="my profile" className="w-12 h-12 rounded-full object-cover" />
</Link>
</li>
</ul>


<div className="md:hidden flex items-center">
<button onClick={toggleMobileMenu} className="focus:outline-none">
{isMobileMenuOpen ? <FaTimes size={24} /> : <FaBars size={24} />}
</button>


</div>
</nav>
</header>
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const Profile = () => {
<h1 className="text-3xl text-center capitalize text-red-800 font-semibold mb-8">
RISTHA - naye bandhono ka
</h1>

<h1 className="text-3xl text-center capitalize text-slate-500 font-semibold mb-8">
my profile
</h1>
<div className="max-w-4xl mx-auto p-6 rounded-lg shadow-md" id="profile">
<div className="bg-red-100 flex flex-col md:flex-row items-center gap-6 p-6 rounded-lg shadow-md" id="top">
<img
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const Register = () => {
<h2 className="text-2xl text-center">welcome to Rishta </h2>
<form className="flex flex-col md:w-1/3 h-auto px-10 mx-auto py-5">
<label htmlFor="name">name</label>
<input type="name" placeholder="name" name="name" className="py-4 px-3 border-2 border-black outline-none rounded-lg " required />
<input type="text" placeholder="name" name="name" className="py-4 px-3 border-2 border-black outline-none rounded-lg " required />
<label htmlFor="email" className="mt-4">email</label>
<input type="email" placeholder="Email" name="email" className="py-4 px-3 border-2 border-black outline-none rounded-lg " required />
<label htmlFor="password" className="mt-4">password</label>
<input type="password" placeholder="Password" className="py-4 px-3 border-2 border-black outline-none rounded-lg" required />

<button type="submit" className="py-4 w-32 bg-black text-white hover:bg-[#8C94FF] hover:text-black px-3 border-2 ease-in-out duration-500 border-black outline-none rounded-lg mt-4">Register</button>
<button type="submit" className="py-4 w-32 bg-black text-white hover:bg-[#8C94FF] hover:text-black px-3 border-2 ease-in-out duration-500 border-black outline-none rounded-lg mt-4">continue</button>
</form>

<div>
Expand Down
159 changes: 159 additions & 0 deletions client/src/components/user/userDetails.jsx/UserDetails.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";

const UserDetails = () => {
const [previewImage, setPreviewImage] = useState(null);
const navigate = useNavigate()


const ProfileRegister = () => {
navigate("/registration/user/VerifyDocs")
}

const handleImageChange = (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = () => {
setPreviewImage(reader.result);
};
reader.readAsDataURL(file);
} else {
setPreviewImage(null);
}
};

// Define an array of objects containing the input field details
const inputFields = [
{ label: "Name", placeholder: "Name", name: "name", type: "text" },
{ label: "Father's Name", placeholder: "Father's Name", name: "fatherName", type: "text" },
{ label: "Surname", placeholder: "Surname", name: "surname", type: "text" },
{ label: "Mother's Name", placeholder: "Mother's Name", name: "motherName", type: "text" },
{ label: "Age", placeholder: "Age", name: "age", type: "number" },
{ label: "Gender", placeholder: "Select Gender", name: "gender", type: "select", options: ["Male", "Female", "Other"] },
{ label: "Date of Birth", name: "dob", type: "date" },
{ label: "Phone Number", placeholder: "Phone Number", name: "phone", type: "tel" },
{ label: "Email", placeholder: "Email", name: "email", type: "email" },
{ label: "Address", placeholder: "Address", name: "address", type: "textarea" },
{ label: "Height", placeholder: "Height", name: "height", type: "text" },
{ label: "Weight", placeholder: "Weight (e.g., 70kg)", name: "weight", type: "text" },
{ label: "Complexion", placeholder: "Complexion", name: "complexion", type: "text" },
{ label: "Education", placeholder: "Education", name: "education", type: "text" },
{ label: "Occupation", placeholder: "Occupation", name: "occupation", type: "text" },
{ label: "Annual Income", placeholder: "Annual Income", name: "income", type: "text" },
{ label: "Preferred Age Range", placeholder: "Preferred Age Range", name: "preferredAge", type: "text" },
{ label: "Preferred Height Range", placeholder: "in feet", name: "preferredHeight", type: "text" },
{ label: "Preferred Education", placeholder: "Preferred Education", name: "preferredEducation", type: "text" },
{ label: "Preferred Profession", placeholder: "Preferred Profession", name: "preferredProfession", type: "text" },
];

return (
<>
<section className="w-full bg-gradient-to-br from-[#FFF7FC] to-[#E6E6FA] flex justify-center items-center min-h-screen py-20 animate-fade">
<main className="w-full max-w-4xl py-12 bg-white shadow-lg rounded-lg px-4 md:px-10">
<h1 className="text-3xl text-center font-semibold mb-4 text-gray-800">Register</h1>
<h2 className="text-2xl text-center mb-2 text-gray-700">Welcome to Rishta</h2>
<h2 className="text-2xl text-center mb-8 text-gray-700">Complete Your Rishta Profile</h2>

<form className="flex flex-wrap justify-center gap-6 mx-auto py-5">
<div className="flex justify-center mb-6 w-full md:w-auto">
<div className="relative ">
<img
src={previewImage || "https://via.placeholder.com/150"}
alt="Avatar"
className="rounded-full w-32 h-32 object-cover border-4 border-gray-300"
/>
<label
htmlFor="avatar"
className="absolute bottom-0 right-0 cursor-pointer bg-indigo-500 text-white rounded-full p-2 hover:bg-indigo-600 transition-colors duration-300"
>
<input
type="file"
name="avatar"
id="avatar"
className="hidden"
onChange={handleImageChange}
/>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
className="w-6 h-6"
>
<path
fillRule="evenodd"
d="M12 5.25a5.25 5.25 0 016.775 7.898.75.75 0 011.106.166.75.75 0 01-1.074 1.064A7.001 7.001 0 1018 12c0-3.865-3.135-7-7-7a6.99 6.99 0 00-1.898 13.992.75.75 0 111.033-1.09A5.25 5.25 0 0112 5.25zM9 9a3 3 0 116 0 3 3 0 01-6 0z"
clipRule="evenodd"
/>
</svg>
</label>
</div>
</div>

{/* Map over inputFields array to render input fields */}
{inputFields.map((field, index) => (
<div key={index} className="flex flex-col mb-4 w-full md:w-1/2 lg:w-1/3">
<label htmlFor={field.name} className="flex text-gray-700 font-semibold mb-1">
{field.label}
</label>
{field.type === 'select' ?
(
<select
name={field.name}
className="py-2 px-3 border-2 border-gray-300 outline-none rounded-lg focus:border-indigo-500 transition-colors duration-300" required >

<option value="">{field.placeholder}</option>
{field.options.map((option, i) => (
<option key={i} value={option}>
{option}
</option>

))}
</select>
) :
field.type === 'date' ? (

<input type="date" name={field.name} className="py-2 px-3 border-2 border-gray-300 outline-none rounded-lg focus:border-indigo-500 transition-colors duration-300" required />

) :
field.type === 'textarea' ? (

<textarea
placeholder={field.placeholder}
name={field.name}
className="py-2 px-3 border-2 border-gray-300 outline-none rounded-lg focus:border-indigo-500 transition-colors duration-300"
required
></textarea>


) : (
<input
type={field.type}
placeholder={field.placeholder}
name={field.name}
className="py-2 px-3 border-2 border-gray-300 outline-none rounded-lg focus:border-indigo-500 transition-colors duration-300"
required
/>
)}
</div>
))}
<div className="flex flex-col mb-4 w-full md:w-1/2 lg:w-1/3">

<button
type="button"
className="py-4 w-full md:w-1/2 lg:w-1/3 bg-indigo-600 text-white hover:bg-indigo-700 px-3 border-2 border-indigo-600 ease-in-out duration-300 outline-none rounded-lg mt-4 mx-auto "
onClick={()=>ProfileRegister()}
>
continue
</button>
</div>

</form>
</main>
</section>

</>
);
};

export default UserDetails;
Loading

0 comments on commit 3b6cc42

Please sign in to comment.