From 2ca772c7fe80be03df2be597eaba2c7faf24b3c6 Mon Sep 17 00:00:00 2001 From: sonnguyenkieio Date: Thu, 9 Sep 2021 18:36:25 +0700 Subject: [PATCH] :sparkles: feat: Account Page --- .../AccountPage/AccountPage.module.scss | 17 +------ .../account/AccountPage/AccountPage.tsx | 50 ++++++------------- .../AccountInfomation/AccountInfomation.tsx | 13 ++--- .../EditInfoModal/EditInfoModal.module.scss | 2 - .../OrderInformation/OrderInformation.tsx | 5 +- .../components/TabPane/TabPane.module.scss | 23 --------- .../components/TabPane/TabPane.tsx | 20 -------- 7 files changed, 26 insertions(+), 104 deletions(-) delete mode 100644 src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss delete mode 100644 src/components/modules/account/AccountPage/components/TabPane/TabPane.tsx diff --git a/src/components/modules/account/AccountPage/AccountPage.module.scss b/src/components/modules/account/AccountPage/AccountPage.module.scss index a3e3f1525..faa4582ee 100644 --- a/src/components/modules/account/AccountPage/AccountPage.module.scss +++ b/src/components/modules/account/AccountPage/AccountPage.module.scss @@ -1,22 +1,9 @@ @import '../../../../styles/utilities'; .accountPage { - @apply flex spacing-horizontal; + @apply spacing-horizontal; background-color: #F5F4F2; margin-top: -3.2rem; + padding-top: 3.2rem; padding-bottom: 3.2rem; - - .pageLeft { - padding-top: 5.6rem; - margin-right: 12.4rem; - - .accNavi{ - margin-top: 3.8rem; - } - } - - .pageRight { - padding-top: 5.6rem; - width: 100%; - } } \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/AccountPage.tsx b/src/components/modules/account/AccountPage/AccountPage.tsx index 2dcc73e1a..d150c72f3 100644 --- a/src/components/modules/account/AccountPage/AccountPage.tsx +++ b/src/components/modules/account/AccountPage/AccountPage.tsx @@ -1,4 +1,4 @@ -import React, { useRef, useState } from "react" +import React, { useState } from "react" import s from './AccountPage.module.scss' import AccountNavigation from '../AccountNavigation/AccountNavigation' @@ -6,18 +6,9 @@ import HeadingCommon from '../../../common/HeadingCommon/HeadingCommon' import AccountInfomation from "./components/AccountInfomation/AccountInfomation" import OrderInfomation from './components/OrderInformation/OrderInformation' import EditInfoModal from './components/EditInfoModal/EditInfoModal' +import TabPane from "src/components/common/TabCommon/components/TabPane/TabPane" const waiting = [ - { - id: "NO 123456", - products: ["Tomato", "Fish", "Pork", "Onion"], - totalPrice : 1000 - }, - { - id: "NO 123456", - products: ["Tomato", "Fish", "Pork", "Onion"], - totalPrice : 1000 - }, { id: "NO 123456", products: ["Tomato", "Fish", "Pork", "Onion"], @@ -57,7 +48,7 @@ interface AccountPageProps { const AccountPage = ({defaultActiveContent="orders"} : AccountPageProps) => { - const [activeTab, setActiveTab] = useState(defaultActiveContent==="info"? 0 : defaultActiveContent==="orders"? 1 : 2) + const [activeTab] = useState(defaultActiveContent==="info" ? 0 : defaultActiveContent==="orders" ? 1 : 2) const [modalVisible, setModalVisible] = useState(false); function showModal() { @@ -68,33 +59,22 @@ const AccountPage = ({defaultActiveContent="orders"} : AccountPageProps) => { setModalVisible(false); } - const changeTab = (tabIndex: number) => { - setActiveTab(tabIndex); - } - - const accNavItems = [ - {ref: useRef(null), active: activeTab===0, itemName: "Customer Information", onClick: changeTab}, - {ref: useRef(null), active: activeTab===1, itemName: "Your Orders", onClick: changeTab}, - {ref: useRef(null), active: activeTab===2, itemName: "Favorites", onClick: changeTab} - ] - return ( <>
-
- Account -
- -
-
- -
- - + Account - {/* Thieu cai favorite */} - {/* */} -
+ + + + + + + + + {/* */} + +
diff --git a/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx index 6bc1c4a72..f24b36216 100644 --- a/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx +++ b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx @@ -4,13 +4,16 @@ import s from './AccountInfomation.module.scss' import Image from "next/image" import avatar from '../../assets/avatar.png'; +interface AccountProps { + name: string, email: string, address: string, state: string, city: string, postalCode: string, phoneNumber: string +} + interface AccountInfomationProps { - account: {name: string, email: string, address: string, state: string, city: string, postalCode: string, phoneNumber: string}; - active: boolean; + account: AccountProps; onClick: () => void; } -const AccountInfomation = ({ account, active=false, onClick } : AccountInfomationProps) => { +const AccountInfomation = ({ account, onClick } : AccountInfomationProps) => { // need to handle call back when edit account information @@ -19,7 +22,7 @@ const AccountInfomation = ({ account, active=false, onClick } : AccountInfomatio return (
{ - active &&
+
avatar
@@ -46,8 +49,6 @@ const AccountInfomation = ({ account, active=false, onClick } : AccountInfomatio
Edit
} - -
) } diff --git a/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss index 0942359ab..be1384ab7 100644 --- a/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss +++ b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss @@ -58,7 +58,6 @@ @apply bg-white text-center font-bold custom-border-radius-lg; color: #141414; border: 1px solid #141414; - // border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%; padding: 1.6rem; margin-right: 1.6rem; width: 100%; @@ -72,7 +71,6 @@ @apply text-center font-bold custom-border-radius-lg; background-color: var(--primary); color: white; - // border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%; padding: 1.6rem; width: 100%; &:hover { diff --git a/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx index 189753192..98f305b9e 100644 --- a/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx +++ b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx @@ -10,15 +10,14 @@ interface OrderInformationProps { waiting: {id: string, products: string[], totalPrice: number}[], delivering: {id: string, products: string[], totalPrice: number}[], delivered: {id: string, products: string[], totalPrice: number}[], - active: boolean } -const OrderInformation = ({ waiting, delivering, delivered, active } : OrderInformationProps) => { +const OrderInformation = ({ waiting, delivering, delivered} : OrderInformationProps) => { return (
{ - active &&
+
Order Information
diff --git a/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss b/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss deleted file mode 100644 index 6904a6acb..000000000 --- a/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss +++ /dev/null @@ -1,23 +0,0 @@ -@import '../../../../../../styles/utilities'; - -.tabPane { - @apply hidden; - animation-duration: 0.6s; - animation-name: appear; - @keyframes appear { - from { - margin-left: 100%; - width: 200%; - } - - to { - margin-left: 0%; - width: 100%; - } - } - - - &.active { - @apply block; - } -} \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/TabPane/TabPane.tsx b/src/components/modules/account/AccountPage/components/TabPane/TabPane.tsx deleted file mode 100644 index 3b39291b7..000000000 --- a/src/components/modules/account/AccountPage/components/TabPane/TabPane.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import classNames from "classnames" -import React from "react" -import s from './TabPane.module.scss' - -interface TabPaneProps { - active: string; - children?: React.ReactNode; -} - -const TabPane = ({ active="", children } : TabPaneProps) => { - return ( -
- {children} -
- ) -} - -export default TabPane \ No newline at end of file