From efe6ecf00530e5aef4980028cea8071b552983d0 Mon Sep 17 00:00:00 2001 From: sonnguyenkieio Date: Tue, 7 Sep 2021 10:25:24 +0700 Subject: [PATCH] :sparkles: feat: Account Page --- .../AccountPage/AccountPage.module.scss | 22 +++ .../account/AccountPage/AccountPage.tsx | 134 ++++++++++++++++++ .../account/AccountPage/assets/avatar.png | Bin 0 -> 4653 bytes .../AccountInfomation.module.scss | 49 +++++++ .../AccountInfomation/AccountInfomation.tsx | 50 +++++++ .../EditInfoModal/EditInfoModal.module.scss | 67 +++++++++ .../EditInfoModal/EditInfoModal.tsx | 52 +++++++ .../OrderInformation.module.scss | 16 +++ .../OrderInformation/OrderInformation.tsx | 68 +++++++++ .../components/TabPane/TabPane.module.scss | 23 +++ .../components/TabPane/TabPane.tsx | 20 +++ 11 files changed, 501 insertions(+) create mode 100644 src/components/modules/account/AccountPage/AccountPage.module.scss create mode 100644 src/components/modules/account/AccountPage/AccountPage.tsx create mode 100644 src/components/modules/account/AccountPage/assets/avatar.png create mode 100644 src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.module.scss create mode 100644 src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx create mode 100644 src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss create mode 100644 src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.tsx create mode 100644 src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.module.scss create mode 100644 src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx create mode 100644 src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss create 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 new file mode 100644 index 000000000..a3e3f1525 --- /dev/null +++ b/src/components/modules/account/AccountPage/AccountPage.module.scss @@ -0,0 +1,22 @@ +@import '../../../../styles/utilities'; + +.accountPage { + @apply flex spacing-horizontal; + background-color: #F5F4F2; + margin-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 new file mode 100644 index 000000000..5f3749a28 --- /dev/null +++ b/src/components/modules/account/AccountPage/AccountPage.tsx @@ -0,0 +1,134 @@ +import React, { useEffect, useState } from "react" +import s from './AccountPage.module.scss' + +import AccountNavigation from '../AccountNavigation/AccountNavigation' +import HeadingCommon from '../../../common/HeadingCommon/HeadingCommon' +import AccountInfomation from "./components/AccountInfomation/AccountInfomation" +import OrderInfomation from './components/OrderInformation/OrderInformation' +import EditInfoModal from './components/EditInfoModal/EditInfoModal' + +interface AccountPageProps { + +} + +const AccountPage = ({} : AccountPageProps) => { + 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"], + totalPrice : 1000 + } + ] + + const delivering = [ + { + 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"], + totalPrice : 1000 + } + ] + + const delivered = [ + { + 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"], + totalPrice : 1000 + } + ] + + const account = { + name: "vu duong", + email: "vuduong@gmail.com", + address: "234 Dien Bien Phu Bis, Dakao ward, District 1, HCMC", + postalCode: "700000", + phoneNumber: "(+84) 937 937 195" + } + + const [accountInfoActive, setAccountInfoActive] = useState(false); + const [orderInfoActive, setOrderInfoActive] = useState(true); + const [favoritesActive, setFavoritesActive] = useState(false); + + function accountActive() { + setAccountInfoActive(true); + setOrderInfoActive(false); + setFavoritesActive(false); + } + + function orderActive() { + setAccountInfoActive(false); + setOrderInfoActive(true); + setFavoritesActive(false); + } + + function favActive() { + setAccountInfoActive(false); + setOrderInfoActive(false); + setFavoritesActive(true); + } + + const [modalVisible, setModalVisible] = useState(false); + + function showEditForm() { + setModalVisible(true); + } + + function closeModal() { + setModalVisible(false); + } + + return ( + <> +
+
+ Account +
+ +
+
+ +
+ + + + {/* Thieu cai favorite */} + {/* */} +
+ + +
+ + + ) +} + +export default AccountPage \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/assets/avatar.png b/src/components/modules/account/AccountPage/assets/avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..b12cabed409308fc3b03e6be2642524c1b886bb3 GIT binary patch literal 4653 zcmV+|64LF7P)J(~!R%Ylbk))`+tXFuQ`Obo_56}%hF#q+=GlLJ_l8h32L}h6>LJsYd45vA+q`X4 z|GoOWPN5(7maa$oaaTVU8yg#YLQ!l81*d~GlQKjfsq36P2~-RwfQ7mq=;yl(Vt5Rk zXF6Qx^!2ek3D+1DQicy9%!MKJj)7ZKC1C&4k29H;T*?sMRpHBp*22JbphI>=o`ft` z(=diyUAOS40$2#O!oWFFAbfE2fJ-67!0Bp+zS%`#&_dc# z*LLc`OEz$9Hb#?68N6H)lw9B#w86+F!QdqmI0kL7a&=u-!P}JtOg?aW{_JyM(1vbD z66oU{lZnEpqq;s*Pag`yHU?MJ^-%qreXf5=PSPYRocagD@cx!?)N!l|DXZO%Ow6PL zr-Fucji_ofp(!ZTbzw@)%tHk7C`HaxWUCr;w3WyU|rRJpzfo8pD>ZOkMZYYvG!V%xEf{ zUd@l@#OQv=6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Kybn literal 0 HcmV?d00001 diff --git a/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.module.scss b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.module.scss new file mode 100644 index 000000000..6e5e0c325 --- /dev/null +++ b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.module.scss @@ -0,0 +1,49 @@ +@import '../../../../../../styles/utilities'; + +.accountInfomation { + transition: opacity 6s; + + .avatar { + height: 22rem; + width: 22rem; + border-radius: 50%; + margin-bottom: 4rem; + } + + .accountName { + @apply heading-3 font-heading; + } + + .horizontalSeparator{ + border: 1px solid var(--disabled); + max-width: 39.2rem; + min-width: 30rem; + margin-top: 2.4rem; + margin-bottom: 2.4rem; + } + + .shippingInfo { + @apply heading-3 font-heading; + } + + .accountAddress { + max-width: 31rem; + min-width: none; + } + + .editInfoBtn { + @apply text-center font-bold; + margin-top: 2.4rem; + margin-bottom: 2.4rem; + padding: .8rem 1.6rem; + color: #141414; + border: 1px solid #141414; + max-width: 8.8rem; + border-radius: 25%; + + &:hover { + @apply cursor-pointer; + background-color: #FBFBFB; + } + } +} \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx new file mode 100644 index 000000000..b2961c8df --- /dev/null +++ b/src/components/modules/account/AccountPage/components/AccountInfomation/AccountInfomation.tsx @@ -0,0 +1,50 @@ +import React, { useState } from "react" +import s from './AccountInfomation.module.scss' + +import Image from "next/image" +import avatar from '../../assets/avatar.png'; + +interface AccountInfomationProps { + account: {name: string, email: string, address: string, postalCode: string, phoneNumber: string}; + active: boolean; + clickShowEditForm: ()=>void; +} + +const AccountInfomation = ({ account, active=false, clickShowEditForm } : AccountInfomationProps) => { + return ( +
+ { + active &&
+
+ avatar +
+ +
+ {account.name} +
+
+ {account.email} +
+ +
+ +
Shipping Infomation
+ +
+ {account.address + `, ${account.postalCode}`} +
+ +
+ {account.phoneNumber} +
+ +
Edit
+
+ } + + +
+ ) +} + +export default AccountInfomation \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss new file mode 100644 index 000000000..e9431f32a --- /dev/null +++ b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.module.scss @@ -0,0 +1,67 @@ +@import '../../../../../../styles/utilities'; + +.editInfoModal { + .input { + @apply bg-white; + margin-bottom: 1.6rem; + width: 100%; + border: 2px solid #EBEBEB; + border-radius: .8rem; + padding: 1.6rem; + } + + .inputState { + @apply bg-white; + margin-bottom: 1.6rem; + margin-right: 1.6rem; + border: 2px solid #EBEBEB; + border-radius: .8rem; + padding: 1.6rem; + } + + .inputPostalCode { + @apply bg-white; + margin-bottom: 1.6rem; + border: 2px solid #EBEBEB; + border-radius: .8rem; + padding: 1.6rem; + } + + .inputPhoneNumber { + @apply bg-white; + margin-bottom: 4rem; + width: 100%; + border: 2px solid #EBEBEB; + border-radius: .8rem; + padding: 1.6rem; + } + + .buttons { + @apply flex; + + .buttonCancel { + @apply bg-white text-center font-bold; + color: #141414; + border: 1px solid #141414; + border-radius: 2.5rem; + padding: 1.6rem; + margin-right: 1.6rem; + + &:hover { + @apply cursor-pointer; + } + } + + .buttonSave { + @apply text-center font-bold; + background-color: var(--primary); + color: white; + border-radius: 2.5rem; + padding: 1.6rem; + + &:hover { + @apply cursor-pointer; + } + } + } +} \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.tsx b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.tsx new file mode 100644 index 000000000..2d593c97e --- /dev/null +++ b/src/components/modules/account/AccountPage/components/EditInfoModal/EditInfoModal.tsx @@ -0,0 +1,52 @@ +import classNames from "classnames" +import React from "react" +import s from './EditInfoModal.module.scss' + +import {ModalCommon, MenuDropdown} from '../../../../../common' + +interface EditInfoModalProps { + visible: boolean; + closeModal: () => void; +} + +const EditInfoModal = ({ visible = false, closeModal }: EditInfoModalProps) => { + + function saveInfo() { + console.log("saved !!!"); + + closeModal(); + } + + const options = [ + {name: "hihi"}, + {name: "hihi"}, + {name: "hihi"} + ] + + return ( + +
+
+
+
+
+ +
+ {/* */} + + {/* */} + +
+ +
+ +
+
Cancel
+
Save
+
+
+
+ ) +} + +export default EditInfoModal \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.module.scss b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.module.scss new file mode 100644 index 000000000..90b0450bf --- /dev/null +++ b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.module.scss @@ -0,0 +1,16 @@ +@import '../../../../../../styles/utilities'; + +.orderInformation { + .title { + @apply heading-3 font-heading; + margin-top: 1.6rem; + } + + .tabs { + margin-top: 3.2rem; + } + + .tabPanes { + margin-top: 2.4rem; + } +} \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx new file mode 100644 index 000000000..3dce97570 --- /dev/null +++ b/src/components/modules/account/AccountPage/components/OrderInformation/OrderInformation.tsx @@ -0,0 +1,68 @@ +import React, {useState} from "react" +import s from './OrderInformation.module.scss' + +import { TabCommon } from '../../../../../common' +import TabPane from '../../components/TabPane/TabPane' +import DeliveryItem from '../../../DeliveryItem/DeliveryItem' + + +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=true } : OrderInformationProps) => { + const [activeTabPane, setActiveTabPane] = useState("waiting"); + + function changeTabPane(tab: string) { + setActiveTabPane(tab); + } + + return ( +
+ { + active &&
+
Order Information
+ +
+ + +
+ + { + waiting.map((order, i) => { + return ( + + ) + }) + } + + + { + delivering.map((order, i) => { + return ( + + ) + }) + } + + + { + delivered.map((order, i) => { + return ( + + ) + }) + } + +
+
+
+ } +
+ ) +} + +export default OrderInformation \ No newline at end of file diff --git a/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss b/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss new file mode 100644 index 000000000..6904a6acb --- /dev/null +++ b/src/components/modules/account/AccountPage/components/TabPane/TabPane.module.scss @@ -0,0 +1,23 @@ +@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 new file mode 100644 index 000000000..3b39291b7 --- /dev/null +++ b/src/components/modules/account/AccountPage/components/TabPane/TabPane.tsx @@ -0,0 +1,20 @@ +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