♻️ enhan: replace link in delivery item to button common

:%s
This commit is contained in:
lytrankieio123
2021-09-15 14:37:21 +07:00
parent f4fc30a792
commit a7d39f3d1a
4 changed files with 10 additions and 27 deletions

View File

@@ -25,7 +25,7 @@ const OrderInformation = ({ waiting, delivering, delivered} : OrderInformationPr
{
waiting.map((order, i) => {
return (
<DeliveryItem key={order.id} 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} />
)
})
}
@@ -36,7 +36,7 @@ const OrderInformation = ({ waiting, delivering, delivered} : OrderInformationPr
{
delivering.map((order, i) => {
return (
<DeliveryItem key={order.id} 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} />
)
})
}
@@ -47,7 +47,7 @@ const OrderInformation = ({ waiting, delivering, delivered} : OrderInformationPr
{
delivered.map((order, i) => {
return (
<DeliveryItem key={order.id} 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} />
)
})
}

View File

@@ -9,20 +9,19 @@ import ReOrder from './components/ReOrder/ReOrder'
interface DeliveryItemProps {
id: string;
status: "waiting" | "delivering" | "delivered";
status: "Waiting" | "Delivering" | "Delivered";
products: string[];
totalPrice: number;
reOrderLink?: string;
}
const DeliveryItem = ({ id, status, products, totalPrice, reOrderLink } : DeliveryItemProps) => {
const DeliveryItem = ({ id, status, products, totalPrice } : DeliveryItemProps) => {
return (
<section className={s.deliveryItem}>
<IdAndStatus id={id} status={status} />
<div className={s.separator}></div>
<Products products={products} />
<TotalPrice totalPrice={totalPrice} />
<ReOrder show={status==="delivered" ? true : false} href={reOrderLink} />
<ReOrder show={status === "Delivered" ? true : false}/>
</section>
)
}

View File

@@ -1,22 +1,9 @@
@import '../../../../../../styles/utilities';
.reOrder {
@apply text-white custom-border-radius hidden font-bold;
padding: .4rem .6rem;
@apply hidden;
margin-right: 1.2rem;
background-color: var(--primary);
@screen lg {
padding: .8rem 1.2rem;
margin-right: 2.4rem;
}
&.show {
@apply block;
}
&:hover {
@apply cursor-pointer;
}
}

View File

@@ -1,21 +1,18 @@
import classNames from "classnames"
import React from "react"
import { ButtonCommon } from "src/components/common"
import s from './ReOrder.module.scss'
import Link from 'next/link'
interface ReOrderProps {
show: boolean;
href?: string;
}
const ReOrder = ({ show=false, href="#" } : ReOrderProps) => {
const ReOrder = ({ show=false } : ReOrderProps) => {
return (
<div className={classNames(s.reOrder, {
[s.show]: show
})}>
<Link href={href}>
<a>Re-Order</a>
</Link>
<ButtonCommon>Re-Order</ButtonCommon>
</div>
)
}