Update src/app/shop/[id]/page.tsx
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { use, useCallback } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ReactLenis from "lenis/react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
|
||||
import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard";
|
||||
@@ -66,6 +65,12 @@ export default function ProductPage({ params }: ProductPageProps) {
|
||||
await checkout(getCheckoutItems(), { successUrl: currentUrl.toString() });
|
||||
}, [cartItems, checkout, getCheckoutItems]);
|
||||
|
||||
const footerColumns = [
|
||||
{ title: "Shop", items: [{ label: "All Fragrances", href: "/shop" }, { label: "New Arrivals", href: "/shop" }, { label: "Best Sellers", href: "/shop" }] },
|
||||
{ title: "Company", items: [{ label: "About Us", href: "/#about" }, { label: "Our Story", href: "/#about" }, { label: "Contact", href: "/#contact" }] },
|
||||
{ title: "Support", items: [{ label: "FAQ", href: "/#faq" }, { label: "Shipping", href: "#" }, { label: "Returns", href: "#" }] }
|
||||
];
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<ThemeProvider
|
||||
@@ -80,31 +85,29 @@ export default function ProductPage({ params }: ProductPageProps) {
|
||||
secondaryButtonStyle="layered"
|
||||
headingFontWeight="semibold"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="navbar" data-section="navbar">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="#"
|
||||
/>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading product...</p>
|
||||
</main>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={[{ "title": "Shop", "items": [{ "label": "All Fragrances", "href": "#fragrances" }, { "label": "New Arrivals", "href": "#products" }, { "label": "Best Sellers", "href": "#products" }] }, { "title": "Company", "items": [{ "label": "About Us", "href": "#about" }, { "label": "Our Story", "href": "#about" }, { "label": "Contact", "href": "#contact" }] }, { "title": "Support", "items": [{ "label": "FAQ", "href": "#faq" }, { "label": "Shipping", "href": "#" }, { "label": "Returns", "href": "#" }] }]}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Blog", id: "/blog" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="/"
|
||||
/>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading product...</p>
|
||||
</main>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={footerColumns}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -123,39 +126,37 @@ export default function ProductPage({ params }: ProductPageProps) {
|
||||
secondaryButtonStyle="layered"
|
||||
headingFontWeight="semibold"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="navbar" data-section="navbar">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="#"
|
||||
/>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Blog", id: "/blog" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="/"
|
||||
/>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<div className="text-center">
|
||||
<p className="text-foreground mb-4">Product not found</p>
|
||||
<button
|
||||
onClick={() => router.push("/shop")}
|
||||
className="primary-button px-6 py-2 rounded-theme"
|
||||
>
|
||||
Back to Shop
|
||||
</button>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<div className="text-center">
|
||||
<p className="text-foreground mb-4">Product not found</p>
|
||||
<button
|
||||
onClick={() => router.push("/shop")}
|
||||
className="primary-button px-6 py-2 rounded-theme"
|
||||
>
|
||||
Back to Shop
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={[{ "title": "Shop", "items": [{ "label": "All Fragrances", "href": "#fragrances" }, { "label": "New Arrivals", "href": "#products" }, { "label": "Best Sellers", "href": "#products" }] }, { "title": "Company", "items": [{ "label": "About Us", "href": "#about" }, { "label": "Our Story", "href": "#about" }, { "label": "Contact", "href": "#contact" }] }, { "title": "Support", "items": [{ "label": "FAQ", "href": "#faq" }, { "label": "Shipping", "href": "#" }, { "label": "Returns", "href": "#" }] }]}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</main>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={footerColumns}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -173,64 +174,62 @@ export default function ProductPage({ params }: ProductPageProps) {
|
||||
secondaryButtonStyle="layered"
|
||||
headingFontWeight="semibold"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="navbar" data-section="navbar">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="#"
|
||||
/>
|
||||
</div>
|
||||
<div id="product-detail-card" data-section="product-detail-card">
|
||||
<ProductDetailCard
|
||||
layout="page"
|
||||
name={product.name}
|
||||
price={product.price}
|
||||
salePrice={meta.salePrice}
|
||||
rating={product.rating || 0}
|
||||
description={product.description}
|
||||
images={images}
|
||||
variants={variants.length > 0 ? variants : undefined}
|
||||
quantity={quantityVariant}
|
||||
ribbon={meta.ribbon}
|
||||
inventoryStatus={meta.inventoryStatus}
|
||||
inventoryQuantity={meta.inventoryQuantity}
|
||||
sku={meta.sku}
|
||||
buttons={[
|
||||
{ text: "Add To Cart", onClick: handleAddToCart },
|
||||
{ text: "Buy Now", onClick: handleBuyNow },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div id="product-cart" data-section="product-cart">
|
||||
<ProductCart
|
||||
isOpen={cartOpen}
|
||||
onClose={() => setCartOpen(false)}
|
||||
items={cartItems}
|
||||
onQuantityChange={updateQuantity}
|
||||
onRemove={removeItem}
|
||||
total={`$${cartTotal}`}
|
||||
buttons={[
|
||||
{
|
||||
text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={[{ "title": "Shop", "items": [{ "label": "All Fragrances", "href": "#fragrances" }, { "label": "New Arrivals", "href": "#products" }, { "label": "Best Sellers", "href": "#products" }] }, { "title": "Company", "items": [{ "label": "About Us", "href": "#about" }, { "label": "Our Story", "href": "#about" }, { "label": "Contact", "href": "#contact" }] }, { "title": "Support", "items": [{ "label": "FAQ", "href": "#faq" }, { "label": "Shipping", "href": "#" }, { "label": "Returns", "href": "#" }] }]}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
navItems={[{ name: "Home", id: "/" }, { name: "Blog", id: "/blog" }, { name: "Shop", id: "/shop" }]}
|
||||
brandName="Zapah"
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
className="py-4 px-6 md:px-10 lg:px-14"
|
||||
navItemClassName="text-lg font-medium"
|
||||
buttonClassName="px-6 py-3 text-lg"
|
||||
logoHref="/"
|
||||
/>
|
||||
</div>
|
||||
<div id="product-detail-card" data-section="product-detail-card">
|
||||
<ProductDetailCard
|
||||
layout="page"
|
||||
name={product.name}
|
||||
price={product.price}
|
||||
salePrice={meta.salePrice}
|
||||
rating={product.rating || 0}
|
||||
description={product.description}
|
||||
images={images}
|
||||
variants={variants.length > 0 ? variants : undefined}
|
||||
quantity={quantityVariant}
|
||||
ribbon={meta.ribbon}
|
||||
inventoryStatus={meta.inventoryStatus}
|
||||
inventoryQuantity={meta.inventoryQuantity}
|
||||
sku={meta.sku}
|
||||
buttons={[
|
||||
{ text: "Add To Cart", onClick: handleAddToCart },
|
||||
{ text: "Buy Now", onClick: handleBuyNow },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div id="product-cart" data-section="product-cart">
|
||||
<ProductCart
|
||||
isOpen={cartOpen}
|
||||
onClose={() => setCartOpen(false)}
|
||||
items={cartItems}
|
||||
onQuantityChange={updateQuantity}
|
||||
onRemove={removeItem}
|
||||
total={`$${cartTotal}`}
|
||||
buttons={[
|
||||
{
|
||||
text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseReveal
|
||||
columns={footerColumns}
|
||||
copyrightText="© 2024 Zapah. All rights reserved."
|
||||
ariaLabel="Footer Navigation"
|
||||
wrapperClassName="mt-10 md:mt-16 lg:mt-24"
|
||||
footerClassName="bg-background py-10"
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user