forked from vercel/commerce
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved using CartModal on checkout page
- Loading branch information
Showing
16 changed files
with
254 additions
and
171 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,45 @@ | ||
import NavbarWithoutCartIcon from 'components/layout/navbar/index-without-cart-icon'; | ||
import { GeistSans } from 'geist/font'; | ||
import { ensureStartsWith } from 'lib/utils'; | ||
import { ReactNode, Suspense } from 'react'; | ||
import '../globals.css'; | ||
|
||
const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env; | ||
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL | ||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` | ||
: 'http://localhost:3000'; | ||
const twitterCreator = TWITTER_CREATOR ? ensureStartsWith(TWITTER_CREATOR, '@') : undefined; | ||
const twitterSite = TWITTER_SITE ? ensureStartsWith(TWITTER_SITE, 'https://') : undefined; | ||
|
||
export const metadata = { | ||
metadataBase: new URL(baseUrl), | ||
title: { | ||
default: SITE_NAME!, | ||
template: `%s | ${SITE_NAME}` | ||
}, | ||
robots: { | ||
follow: true, | ||
index: true | ||
}, | ||
...(twitterCreator && | ||
twitterSite && { | ||
twitter: { | ||
card: 'summary_large_image', | ||
creator: twitterCreator, | ||
site: twitterSite | ||
} | ||
}) | ||
}; | ||
|
||
export default async function RootLayout({ children }: { children: ReactNode }) { | ||
return ( | ||
<html lang="en" className={GeistSans.variable}> | ||
<body className="bg-neutral-50 text-black selection:bg-teal-300 dark:bg-neutral-900 dark:text-white dark:selection:bg-pink-500 dark:selection:text-white"> | ||
<NavbarWithoutCartIcon /> | ||
<Suspense> | ||
<main>{children}</main> | ||
</Suspense> | ||
</body> | ||
</html> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
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,48 @@ | ||
import LogoSquare from 'components/logo-square'; | ||
import { getMenu } from 'lib/ecwid'; | ||
import { Menu } from 'lib/ecwid/types'; | ||
import Link from 'next/link'; | ||
import MobileMenu from './mobile-menu'; | ||
import Search from './search'; | ||
const { SITE_NAME } = process.env; | ||
|
||
export default async function NavbarWithoutCartIcon() { | ||
const menu = await getMenu('next-js-frontend-header-menu'); | ||
|
||
return ( | ||
<nav className="relative flex items-center justify-between p-4 lg:px-6"> | ||
<div className="block flex-none md:hidden"> | ||
<MobileMenu menu={menu} /> | ||
</div> | ||
<div className="flex w-full items-center"> | ||
<div className="flex w-full md:w-1/3"> | ||
<Link href="/" className="mr-2 flex w-full items-center justify-center md:w-auto lg:mr-6"> | ||
<LogoSquare /> | ||
<div className="ml-2 flex-none text-sm font-medium uppercase md:hidden lg:block"> | ||
{SITE_NAME} | ||
</div> | ||
</Link> | ||
{menu.length ? ( | ||
<ul className="hidden gap-6 text-sm md:flex md:items-center"> | ||
{menu.map((item: Menu) => ( | ||
<li key={item.title}> | ||
<Link | ||
href={item.path} | ||
className="text-neutral-500 underline-offset-4 hover:text-black hover:underline dark:text-neutral-400 dark:hover:text-neutral-300" | ||
> | ||
{item.title} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
) : null} | ||
</div> | ||
<div className="hidden justify-center md:flex md:w-2/3"> | ||
<Search /> | ||
</div> | ||
<div className="flex justify-end md:w-1/3"> | ||
</div> | ||
</div> | ||
</nav> | ||
); | ||
} |