mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 04:14:18 +00:00
✨ feat: Account Page
This commit is contained in:
parent
06fc9cb288
commit
a52a673a7f
@ -8,6 +8,16 @@ import OrderInfomation from './components/OrderInformation/OrderInformation'
|
|||||||
import EditInfoModal from './components/EditInfoModal/EditInfoModal'
|
import EditInfoModal from './components/EditInfoModal/EditInfoModal'
|
||||||
|
|
||||||
const waiting = [
|
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",
|
id: "NO 123456",
|
||||||
products: ["Tomato", "Fish", "Pork", "Onion"],
|
products: ["Tomato", "Fish", "Pork", "Onion"],
|
||||||
@ -85,8 +95,6 @@ const AccountPage = ({defaultActiveContent="orders"} : AccountPageProps) => {
|
|||||||
{/* Thieu cai favorite */}
|
{/* Thieu cai favorite */}
|
||||||
{/* <FavoriteProduct active={favoritesActive} favProducts={favProducts} /> */}
|
{/* <FavoriteProduct active={favoritesActive} favProducts={favProducts} /> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<EditInfoModal accountInfo={account} closeModal={closeModal} visible={modalVisible} />
|
<EditInfoModal accountInfo={account} closeModal={closeModal} visible={modalVisible} />
|
||||||
</>
|
</>
|
||||||
|
@ -32,14 +32,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.editInfoBtn {
|
.editInfoBtn {
|
||||||
@apply text-center font-bold;
|
@apply text-center font-bold custom-border-radius;
|
||||||
margin-top: 2.4rem;
|
margin-top: 2.4rem;
|
||||||
margin-bottom: 2.4rem;
|
margin-bottom: 2.4rem;
|
||||||
padding: .8rem 1.6rem;
|
padding: .8rem 1.6rem;
|
||||||
color: #141414;
|
color: #141414;
|
||||||
border: 1px solid #141414;
|
border: 1px solid #141414;
|
||||||
max-width: 8.8rem;
|
max-width: 8.8rem;
|
||||||
border-radius: 25%;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@apply cursor-pointer;
|
@apply cursor-pointer;
|
||||||
|
@ -55,10 +55,10 @@
|
|||||||
@apply flex;
|
@apply flex;
|
||||||
|
|
||||||
.buttonCancel {
|
.buttonCancel {
|
||||||
@apply bg-white text-center font-bold;
|
@apply bg-white text-center font-bold custom-border-radius-lg;
|
||||||
color: #141414;
|
color: #141414;
|
||||||
border: 1px solid #141414;
|
border: 1px solid #141414;
|
||||||
border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%;
|
// border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%;
|
||||||
padding: 1.6rem;
|
padding: 1.6rem;
|
||||||
margin-right: 1.6rem;
|
margin-right: 1.6rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -69,10 +69,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.buttonSave {
|
.buttonSave {
|
||||||
@apply text-center font-bold;
|
@apply text-center font-bold custom-border-radius-lg;
|
||||||
background-color: var(--primary);
|
background-color: var(--primary);
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%;
|
// border-radius: 40% 30% 35% 20%/ 65% 55% 45% 50%;
|
||||||
padding: 1.6rem;
|
padding: 1.6rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -4,6 +4,8 @@ import s from './EditInfoModal.module.scss'
|
|||||||
|
|
||||||
import {ModalCommon, MenuDropdown} from '../../../../../common'
|
import {ModalCommon, MenuDropdown} from '../../../../../common'
|
||||||
|
|
||||||
|
import {ButtonCommon} from '../../../../../common'
|
||||||
|
|
||||||
interface EditInfoModalProps {
|
interface EditInfoModalProps {
|
||||||
accountInfo: {name: string, email: string, address: string, state: string, city: string, postalCode: string, phoneNumber: string};
|
accountInfo: {name: string, email: string, address: string, state: string, city: string, postalCode: string, phoneNumber: string};
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
margin-top: 3.2rem;
|
margin-top: 3.2rem;
|
||||||
}
|
|
||||||
|
.blank {
|
||||||
.tabPanes {
|
margin-bottom: 2.4rem;
|
||||||
margin-top: 2.4rem;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import React, {useRef, useState, RefObject} from "react"
|
import React from "react"
|
||||||
import s from './OrderInformation.module.scss'
|
import s from './OrderInformation.module.scss'
|
||||||
|
|
||||||
import { TabCommon } from '../../../../../common'
|
import { TabCommon } from '../../../../../common'
|
||||||
import TabPane from '../../components/TabPane/TabPane'
|
import TabPane from 'src/components/common/TabCommon/components/TabPane/TabPane'
|
||||||
import DeliveryItem from '../../../DeliveryItem/DeliveryItem'
|
import DeliveryItem from '../../../DeliveryItem/DeliveryItem'
|
||||||
|
|
||||||
|
|
||||||
@ -13,31 +13,7 @@ interface OrderInformationProps {
|
|||||||
active: boolean
|
active: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const OrderInformation = ({ waiting, delivering, delivered, active=true } : OrderInformationProps) => {
|
const OrderInformation = ({ waiting, delivering, delivered, active } : OrderInformationProps) => {
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState(0);
|
|
||||||
const [activeTabPane, setActiveTabPane] = useState("waiting");
|
|
||||||
const slider = useRef<HTMLDivElement>(null);
|
|
||||||
|
|
||||||
function slide(ref: RefObject<HTMLLIElement>) {
|
|
||||||
const width = ref.current.offsetWidth;
|
|
||||||
const left = ref.current.offsetLeft;
|
|
||||||
|
|
||||||
slider.current.style.width = (width-48).toString()+"px";
|
|
||||||
slider.current.style.left = left.toString()+"px";
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTabClick(tabIndex: number, tabPane: string) {
|
|
||||||
setActiveTab(tabIndex);
|
|
||||||
setActiveTabPane(tabPane);
|
|
||||||
slide(tabs[tabIndex].ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
const tabs = [
|
|
||||||
{ref: useRef<HTMLLIElement>(null), tabName: "Wait for comfirmation", active: activeTab === 0, onClick: () => onTabClick(0, "waiting") },
|
|
||||||
{ref: useRef<HTMLLIElement>(null), tabName: "Delivering", active: activeTab === 1, onClick: () => onTabClick(1, "delivering") },
|
|
||||||
{ref: useRef<HTMLLIElement>(null), tabName: "Delivered", active: activeTab === 2, onClick: () => onTabClick(2, "delivered") },
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={s.orderInformation}>
|
<section className={s.orderInformation}>
|
||||||
@ -46,37 +22,40 @@ const OrderInformation = ({ waiting, delivering, delivered, active=true } : Orde
|
|||||||
<div className={s.title}>Order Information</div>
|
<div className={s.title}>Order Information</div>
|
||||||
|
|
||||||
<div className={s.tabs}>
|
<div className={s.tabs}>
|
||||||
<TabCommon tabs={tabs} defaultActiveTab={activeTab} sliderRef={slider} slideToTab={slide} />
|
<TabCommon>
|
||||||
|
<TabPane tabName={"Wait for Comfirmation"} >
|
||||||
<div className={s.tabPanes}>
|
<div className={s.blank}></div>
|
||||||
<TabPane active={activeTabPane==="waiting" ? `active` : ""}>
|
|
||||||
{
|
{
|
||||||
waiting.map((order, i) => {
|
waiting.map((order, i) => {
|
||||||
return (
|
return (
|
||||||
<DeliveryItem key={i} id={order.id} status="waiting" products={order.products} totalPrice={order.totalPrice} />
|
<DeliveryItem key={order.id} id={order.id} status="waiting" products={order.products} totalPrice={order.totalPrice} />
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane active={activeTabPane==="delivering" ? `active` : ""}>
|
|
||||||
|
<TabPane tabName={"Delivering"}>
|
||||||
|
<div className={s.blank}></div>
|
||||||
{
|
{
|
||||||
delivering.map((order, i) => {
|
delivering.map((order, i) => {
|
||||||
return (
|
return (
|
||||||
<DeliveryItem key={i} id={order.id} status="delivering" products={order.products} totalPrice={order.totalPrice} />
|
<DeliveryItem key={order.id} id={order.id} status="delivering" products={order.products} totalPrice={order.totalPrice} />
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane active={activeTabPane==="delivered" ?`active` : ""}>
|
|
||||||
|
<TabPane tabName={"Delivered"}>
|
||||||
|
<div className={s.blank}></div>
|
||||||
{
|
{
|
||||||
delivered.map((order, i) => {
|
delivered.map((order, i) => {
|
||||||
return (
|
return (
|
||||||
<DeliveryItem key={i} id={order.id} status="delivered" products={order.products} totalPrice={order.totalPrice} />
|
<DeliveryItem key={order.id} id={order.id} status="delivered" products={order.products} totalPrice={order.totalPrice} />
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</div>
|
</TabCommon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user