update
This commit is contained in:
@@ -1,10 +1,22 @@
|
||||
'use client';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import type { ProductDetailData } from '@/types';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { BoxPrice } from './BoxPrice';
|
||||
import { BoxBought } from './BoxBought';
|
||||
|
||||
// thêm giỏ hàng
|
||||
import { addToCart } from '@/lib/ButtonCart';
|
||||
|
||||
export const BoxInfoRight = (item: ProductDetailData) => {
|
||||
const router = useRouter();
|
||||
|
||||
const handleBuyNow = () => {
|
||||
router.push('/cart');
|
||||
addToCart(item.product_info.productId);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className="product-name color-black line-clamp-3 font-bold">
|
||||
@@ -81,32 +93,42 @@ export const BoxInfoRight = (item: ProductDetailData) => {
|
||||
+{' '}
|
||||
</p>
|
||||
</div>
|
||||
<Link href="#" className="addCart flex flex-wrap items-center justify-center gap-3">
|
||||
<button
|
||||
className="addCart flex cursor-pointer flex-wrap items-center justify-center gap-3"
|
||||
onClick={() => {
|
||||
addToCart(item.product_info.productId);
|
||||
alert('Sản phẩm đã được thêm vào giỏ hàng!');
|
||||
}}
|
||||
>
|
||||
<i className="sprite sprite-cart-detail"></i>
|
||||
<p className="title-cart">Thêm vào giỏ hàng</p>
|
||||
</Link>
|
||||
</button>
|
||||
<input type="hidden" className="js-buy-quantity-temp" value="1" />
|
||||
</div>
|
||||
|
||||
<div id="detail-buy-ads" className="detail-buy grid grid-cols-2 gap-2">
|
||||
<Link href="#" className="detail-buy-now col-span-2">
|
||||
<div
|
||||
id="detail-buy-ads"
|
||||
className="detail-buy grid grid-cols-2 gap-2"
|
||||
onClick={() => handleBuyNow()}
|
||||
>
|
||||
<button className="detail-buy-now col-span-2 cursor-pointer">
|
||||
<span>ĐẶT MUA NGAY</span>
|
||||
Giao hàng tận nơi nhanh chóng
|
||||
</Link>
|
||||
</button>
|
||||
|
||||
<Link href="#" className="detail-add-cart">
|
||||
<button className="detail-add-cart">
|
||||
<span>TRẢ GÓP QUA HỒ SƠ</span>
|
||||
Chỉ từ 2.665.000₫/ tháng
|
||||
</Link>
|
||||
</button>
|
||||
|
||||
<Link href="#" className="detail-add-cart">
|
||||
<button className="detail-add-cart">
|
||||
<span>TRẢ GÓP QUA THẺ</span>
|
||||
Chỉ từ 1.332.500₫/ tháng
|
||||
</Link>
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
n{/* yên tâm mua hàng */}
|
||||
{/* yên tâm mua hàng */}
|
||||
<div className="box-product-policy-detal boder-radius-10" style={{ marginTop: '24px' }}>
|
||||
<h2 className="title font-[600]">Yên tâm mua hàng</h2>
|
||||
<div className="list-showroom-detail flex flex-wrap justify-between">
|
||||
|
||||
Reference in New Issue
Block a user