diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index 39d0d98..4a2b97b 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -38,7 +38,15 @@ export default function BlogPage() {
{!isLoading && posts && posts.length > 0 && ( - + )}
diff --git a/src/app/shop/[id]/page.tsx b/src/app/shop/[id]/page.tsx index 7126220..e1d2f8f 100644 --- a/src/app/shop/[id]/page.tsx +++ b/src/app/shop/[id]/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { Suspense, use, useCallback } from "react"; +import { Suspense, use, useCallback, useState } from "react"; import { useRouter } from "next/navigation"; import ReactLenis from "lenis/react"; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; @@ -18,9 +18,18 @@ function ProductDetailContent({ const resolvedParams = use(params); const { product, isLoading } = useProductDetail(resolvedParams.id); const router = useRouter(); + const [cartItems, setCartItems] = useState([]); + const [isCartOpen, setIsCartOpen] = useState(false); const handleAddToCart = useCallback(() => { - // Handle add to cart logic + if (product) { + setCartItems([...cartItems, product]); + setIsCartOpen(true); + } + }, [product, cartItems]); + + const handleCloseCart = useCallback(() => { + setIsCartOpen(false); }, []); if (isLoading) { @@ -33,8 +42,24 @@ function ProductDetailContent({ return ( <> - - + + sum + (parseFloat(item.price) || 0), 0)} + buttons={[ + { text: "Continue Shopping", href: "/shop" }, + { text: "Checkout", href: "#" } + ]} + /> ); } diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index 36ccc85..a92508d 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -12,20 +12,19 @@ function ShopPageContent() { const { products, isLoading, - searchQuery, - setSearchQuery, - categoryFilter, - setCategoryFilter, + search, + setSearch, + category, + setCategory, } = useProductCatalog(); return ( ); }