diff --git a/src/App.jsx b/src/App.jsx index 3358f84..a728700 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -23,6 +23,7 @@ import PrivacyPolicy from "./components/Privacy-Policy/PrivacyPolicy"; import TermsConditions from "./components/Terms-Conditions/TermsConditions"; import Feedback from "./components/Feedback/Feedback"; import RentCalculator from './components/rent/RentCalculator'; +import { Profile } from "./pages"; const App = () => { const [isPreloaderVisible, setIsPreloaderVisible] = useState(true); @@ -120,6 +121,7 @@ const App = () => { } /> } /> } /> + } /> )} diff --git a/src/pages/PasswordChange.jsx b/src/pages/PasswordChange.jsx new file mode 100644 index 0000000..96225ed --- /dev/null +++ b/src/pages/PasswordChange.jsx @@ -0,0 +1,53 @@ +import React, { useState } from "react"; +import { toast } from "react-toastify"; + +const PasswordChange = () => { + const [passwords, setPasswords] = useState({ + current: "", + new: "", + confirm: "" + }); + + const handleChange = (e) => { + setPasswords({ ...passwords, [e.target.name]: e.target.value }); + }; + + const handleSubmit = (e) => { + e.preventDefault(); + if (passwords.new !== passwords.confirm) { + toast.error("New passwords do not match."); + return; + } + + // Here you'd typically call an API to update password + toast.success("Password changed successfully!"); + // Optionally clear the form + setPasswords({ current: "", new: "", confirm: "" }); + }; + + return ( +
+

Change Password

+
+ + + + + + + +
+
+ ); +}; + +export default PasswordChange; diff --git a/src/pages/Profile.css b/src/pages/Profile.css new file mode 100644 index 0000000..cdd1633 --- /dev/null +++ b/src/pages/Profile.css @@ -0,0 +1,44 @@ +/* src/pages/Profile.css */ +.profile-container { + max-width: 800px; + margin: 2rem auto; + padding: 2rem; + background: #fff; + border-radius: 8px; + box-shadow: 0 2px 10px rgba(0,0,0,0.1); +} + +.profile-section { + margin-bottom: 2rem; +} + +.profile-form label { + display: block; + margin-bottom: 1rem; + font-weight: 500; +} + +.profile-form input, +.profile-form textarea { + width: 100%; + padding: 0.5rem; + margin-top: 0.25rem; + border: 1px solid #ccc; + border-radius: 4px; +} + +.profile-avatar { + width: 120px; + height: 120px; + border-radius: 50%; + object-fit: cover; + margin-bottom: 1rem; +} + +.profile-avatar.placeholder { + display: flex; + align-items: center; + justify-content: center; + background: #eee; + color: #777; +} diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx new file mode 100644 index 0000000..da434e9 --- /dev/null +++ b/src/pages/Profile.jsx @@ -0,0 +1,19 @@ +// src/pages/Profile.jsx +import React from "react"; +import ProfileForm from "./ProfileForm"; +import ProfilePhoto from "./ProfilePhoto"; +import PasswordChange from "./PasswordChange"; +import "./Profile.css"; + +const Profile = () => { + return ( +
+

Your Profile

+ + + +
+ ); +}; + +export default Profile; \ No newline at end of file diff --git a/src/pages/ProfileForm.jsx b/src/pages/ProfileForm.jsx new file mode 100644 index 0000000..1284ef4 --- /dev/null +++ b/src/pages/ProfileForm.jsx @@ -0,0 +1,58 @@ +import React, { useState } from "react"; +import { toast } from "react-toastify"; + +const ProfileForm = () => { + const [formData, setFormData] = useState({ + fullName: "", + dob: "", + phone: "", + address: "", + email: "user@example.com", // read-only + }); + + const handleChange = (e) => { + setFormData({ ...formData, [e.target.name]: e.target.value }); + }; + + const handleSubmit = (e) => { + e.preventDefault(); + // Here you could call an API + toast.success("Profile details updated successfully!"); + }; + + return ( +
+

Personal Information

+
+ + + + + + + + + + + +
+
+ ); +}; + +export default ProfileForm; diff --git a/src/pages/ProfilePhoto.jsx b/src/pages/ProfilePhoto.jsx new file mode 100644 index 0000000..ad7eb41 --- /dev/null +++ b/src/pages/ProfilePhoto.jsx @@ -0,0 +1,31 @@ +import React, { useState, useEffect } from "react"; + +const ProfilePhoto = () => { + const [photo, setPhoto] = useState(null); + + const handlePhotoChange = (e) => { + const file = e.target.files[0]; + if (file) setPhoto(URL.createObjectURL(file)); + }; + + // Clean up object URL + useEffect(() => { + return () => { + if (photo) URL.revokeObjectURL(photo); + }; + }, [photo]); + + return ( +
+

Profile Photo

+ {photo ? ( + Profile Preview + ) : ( +
No photo
+ )} + +
+ ); +}; + +export default ProfilePhoto; diff --git a/src/pages/index.js b/src/pages/index.js index 23dea8b..b5f2e7a 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -2,4 +2,5 @@ export { default as Home } from "./Home"; export { default as Login } from "./Login"; export { default as Registration } from "./Registration"; export { default as Dashboard } from "./Dashboard"; -export { default as ComingSoon } from "./ComingSoon"; \ No newline at end of file +export { default as ComingSoon } from "./ComingSoon"; +export { default as Profile } from "./Profile"; \ No newline at end of file