-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: latest examples d2c starter kit app directory
- Loading branch information
Showing
208 changed files
with
2,551 additions
and
3,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Blurb from "../../components/shared/blurb"; | ||
|
||
export default function About() { | ||
return <Blurb title="About" />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use client"; | ||
import Cart from "../../components/cart/Cart"; | ||
import CartIcon from "../../components/icons/cart"; | ||
import { useCart } from "@elasticpath/react-shopper-hooks"; | ||
import { resolveShoppingCartProps } from "../../lib/resolve-shopping-cart-props"; | ||
import Link from "next/link"; | ||
|
||
export default function CartPage() { | ||
const { removeCartItem, state } = useCart(); | ||
const shoppingCartProps = resolveShoppingCartProps(state, removeCartItem); | ||
|
||
return ( | ||
<div className="m-auto w-full max-w-base-max-width px-6 py-10 2xl:px-0"> | ||
{shoppingCartProps && ( | ||
<> | ||
<h1 className="pb-5 text-3xl font-bold">Your Shopping Cart</h1> | ||
<Cart {...shoppingCartProps} /> | ||
</> | ||
)} | ||
{(state.kind === "empty-cart-state" || | ||
state.kind === "uninitialised-cart-state" || | ||
state.kind === "loading-cart-state") && ( | ||
<div className="text-center min-h-64"> | ||
<CartIcon className="mx-auto h-24" /> | ||
<h3 className="mt-4 text-sm font-semibold text-gray-900"> | ||
Empty Cart | ||
</h3> | ||
<p className="mt-1 text-sm text-gray-500">Your cart is empty</p> | ||
<div className="mt-6"> | ||
<Link | ||
href="/" | ||
className="inline-flex items-center rounded-md bg-brand-primary px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-highlight focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-highlight" | ||
type="button" | ||
> | ||
Start shopping | ||
</Link> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client"; | ||
import Link from "next/link"; | ||
|
||
export default function GlobalError({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) { | ||
return ( | ||
<html> | ||
<body> | ||
<div className="flex h-[36rem] flex-col items-center justify-center gap-4 p-8"> | ||
<span className="text-center text-xl md:text-3xl"> | ||
{error.digest} - Internal server error. | ||
</span> | ||
<Link href="/" className="font-md md:font-lg text-brand-primary"> | ||
Back to home | ||
</Link> | ||
<button | ||
className="font-md md:font-lg text-brand-secondary" | ||
onClick={() => reset()} | ||
> | ||
Try again | ||
</button> | ||
</div> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Blurb from "../../components/shared/blurb"; | ||
|
||
export default function FAQ() { | ||
return <Blurb title="FAQ" />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Inter } from "next/font/google"; | ||
import { ReactNode, Suspense } from "react"; | ||
import "../styles/globals.css"; | ||
import Header from "../components/header/Header"; | ||
import { getStoreContext } from "../lib/get-store-context"; | ||
import { getServerSideImplicitClient } from "../lib/epcc-server-side-implicit-client"; | ||
import { Providers } from "./providers"; | ||
import { Toaster } from "../components/toast/toaster"; | ||
import Footer from "../components/footer/Footer"; | ||
|
||
const { SITE_NAME } = process.env; | ||
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL | ||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` | ||
: "http://localhost:3000"; | ||
|
||
export const metadata = { | ||
metadataBase: new URL(baseUrl), | ||
title: { | ||
default: SITE_NAME!, | ||
template: `%s | ${SITE_NAME}`, | ||
}, | ||
robots: { | ||
follow: true, | ||
index: true, | ||
}, | ||
}; | ||
|
||
const inter = Inter({ | ||
subsets: ["latin"], | ||
display: "swap", | ||
variable: "--font-inter", | ||
}); | ||
|
||
export default async function RootLayout({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}) { | ||
const client = getServerSideImplicitClient(); | ||
const storeContext = await getStoreContext(client); | ||
|
||
return ( | ||
<html lang="en" className={inter.variable}> | ||
<body> | ||
{/* headless ui needs this div - https://github.com/tailwindlabs/headlessui/issues/2752#issuecomment-1745272229 */} | ||
<div> | ||
<Providers store={storeContext}> | ||
<Header /> | ||
<Toaster /> | ||
<Suspense> | ||
<main>{children}</main> | ||
</Suspense> | ||
<Footer /> | ||
</Providers> | ||
</div> | ||
</body> | ||
</html> | ||
); | ||
} |
3 changes: 1 addition & 2 deletions
3
examples/algolia/src/pages/404.tsx → examples/algolia/src/app/not-found.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import PromotionBanner from "../components/promotion-banner/PromotionBanner"; | ||
import FeaturedProducts from "../components/featured-products/FeaturedProducts"; | ||
import { Suspense } from "react"; | ||
|
||
export default async function Home() { | ||
const promotion = { | ||
title: "Your Elastic Path storefront", | ||
description: | ||
"This marks the beginning, embark on the journey of crafting something truly extraordinary, uniquely yours.", | ||
}; | ||
|
||
return ( | ||
<div> | ||
<PromotionBanner | ||
promotion={promotion} | ||
linkProps={{ | ||
link: "/search", | ||
text: "Shop Now", | ||
}} | ||
/> | ||
<div className="grid gap-12 p-[2rem] md:p-[4em]"> | ||
<div className="gap-3 p-8 md:p-16"> | ||
<div> | ||
<Suspense> | ||
<FeaturedProducts | ||
title="Trending Products" | ||
linkProps={{ | ||
link: `/search`, | ||
text: "See all products", | ||
}} | ||
/> | ||
</Suspense> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.