From ad9f91f718feda788b2c65250bfa44e39f79fcec Mon Sep 17 00:00:00 2001
From: Joshua Ogbonna <58758038+Joshua-Ogbonna@users.noreply.github.com>
Date: Fri, 8 Nov 2024 03:47:33 +0000
Subject: [PATCH] chore: add accordion for addresses
---
src/app/profile-setting/page.js | 379 ++++++++++++++++++++++----------
1 file changed, 263 insertions(+), 116 deletions(-)
diff --git a/src/app/profile-setting/page.js b/src/app/profile-setting/page.js
index f8e206b..f75342b 100644
--- a/src/app/profile-setting/page.js
+++ b/src/app/profile-setting/page.js
@@ -34,6 +34,7 @@ function ProfileSettingsPage() {
const [selectedFile, setSelectedFile] = useState(null);
const [isUploading, setIsUploading] = useState(false);
const [showForm, setShowForm] = useState(false);
+ const [isAddressesOpen, setIsAddressesOpen] = useState(false);
const [currentSection, setCurrentSection] = useState('profile');
@@ -619,121 +620,267 @@ function ProfileSettingsPage() {
/>
-
My Delivery Addresses
- {addresses.length > 0 ? (
- addresses.map((address, index) => (
-
-
Address {index + 1}
-
- {
- handleAddressChange(index, 'full_name', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
- {
- handleAddressChange(index, 'street_address', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
- {
- handleAddressChange(index, 'street_address_2', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
- {
- handleAddressChange(index, 'city', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
- {
- handleAddressChange(index, 'pincode', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
- {
- handleAddressChange(index, 'country', e.target.value);
- setIsEditing(true);
- }}
- style={{ display: 'block', marginBottom: '10px', padding: '10px', borderRadius: '8px', border: '1px solid #D1D5DB' }}
- />
-
-
- ))
- ) : (
- No addresses available. Please add a delivery address.
- )}
- {addresses.length > 0 ? (
-
- ) : (
-
- )}
+
+
+
+
+ {addresses.length > 0 ? (
+ addresses.map((address, index) => (
+
+
+ Address {index + 1}
+
+
+ {
+ handleAddressChange(
+ index,
+ "full_name",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+ {
+ handleAddressChange(
+ index,
+ "street_address",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+ {
+ handleAddressChange(
+ index,
+ "street_address_2",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+ {
+ handleAddressChange(
+ index,
+ "city",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+ {
+ handleAddressChange(
+ index,
+ "pincode",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+ {
+ handleAddressChange(
+ index,
+ "country",
+ e.target.value
+ );
+ setIsEditing(true);
+ }}
+ style={{
+ display: "block",
+ marginBottom: "10px",
+ padding: "10px",
+ borderRadius: "8px",
+ border: "1px solid #D1D5DB",
+ }}
+ />
+
+
+ ))
+ ) : (
+
+ No addresses available. Please add a delivery address.
+
+ )}
+ {addresses.length > 0 ? (
+
+ ) : (
+
+ )}
+
+
@@ -743,7 +890,7 @@ function ProfileSettingsPage() {
onClick={handleSave}
style={{
backgroundColor: '#7D4AB5',
- color: '#ffffff',
+ color: "#30D8FF",
padding: '10px 20px',
borderRadius: '8px',
cursor: 'pointer',