Update src/app/shop/[id]/page.tsx
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { use, useCallback } from "react";
|
import { use, useCallback, useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import ReactLenis from "lenis/react";
|
import ReactLenis from "lenis/react";
|
||||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||||
@@ -19,6 +19,7 @@ interface ProductPageProps {
|
|||||||
export default function ProductPage({ params }: ProductPageProps) {
|
export default function ProductPage({ params }: ProductPageProps) {
|
||||||
const { id } = use(params);
|
const { id } = use(params);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [cartOpen, setCartOpen] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
product,
|
product,
|
||||||
@@ -33,8 +34,8 @@ export default function ProductPage({ params }: ProductPageProps) {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
items: cartItems,
|
items: cartItems,
|
||||||
isOpen: cartOpen,
|
isOpen: isCartOpen,
|
||||||
setIsOpen: setCartOpen,
|
setIsOpen: setIsCartOpen,
|
||||||
addItem,
|
addItem,
|
||||||
updateQuantity,
|
updateQuantity,
|
||||||
removeItem,
|
removeItem,
|
||||||
@@ -236,17 +237,27 @@ export default function ProductPage({ params }: ProductPageProps) {
|
|||||||
logoHref="#"
|
logoHref="#"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div id="productCatalog" data-section="productCatalog">
|
<div id="productDetail" data-section="productDetail">
|
||||||
<ProductCatalog
|
<ProductDetailCard
|
||||||
layout="page"
|
product={product}
|
||||||
products={products}
|
images={images}
|
||||||
searchValue={search}
|
meta={meta}
|
||||||
onSearchChange={setSearch}
|
variants={variants}
|
||||||
searchPlaceholder="Search products..."
|
quantityVariant={quantityVariant}
|
||||||
filters={filters}
|
onAddToCart={handleAddToCart}
|
||||||
emptyMessage="No products found"
|
onBuyNow={handleBuyNow}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<ProductCart
|
||||||
|
isOpen={isCartOpen}
|
||||||
|
onClose={() => setIsCartOpen(false)}
|
||||||
|
items={cartItems}
|
||||||
|
onUpdateQuantity={updateQuantity}
|
||||||
|
onRemoveItem={removeItem}
|
||||||
|
total={cartTotal}
|
||||||
|
onCheckout={handleCheckout}
|
||||||
|
isLoading={isCheckoutLoading}
|
||||||
|
/>
|
||||||
<div id="footer" data-section="footer">
|
<div id="footer" data-section="footer">
|
||||||
<FooterBaseReveal
|
<FooterBaseReveal
|
||||||
columns={[
|
columns={[
|
||||||
@@ -261,7 +272,7 @@ export default function ProductPage({ params }: ProductPageProps) {
|
|||||||
title: "Legal", items: [
|
title: "Legal", items: [
|
||||||
{ label: "Privacy Policy", href: "https://example.com/privacy" },
|
{ label: "Privacy Policy", href: "https://example.com/privacy" },
|
||||||
{ label: "Terms of Service", href: "https://example.com/terms" }
|
{ label: "Terms of Service", href: "https://example.com/terms" }
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Connect", items: [
|
title: "Connect", items: [
|
||||||
|
|||||||
Reference in New Issue
Block a user