Skip to content

Commit

Permalink
Improved using CartModal on checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Apr 19, 2024
1 parent 638c1e8 commit b080326
Show file tree
Hide file tree
Showing 16 changed files with 254 additions and 171 deletions.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions app/(checkout)/layout.tsx
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.
2 changes: 1 addition & 1 deletion app/layout.tsx → app/(shop)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Navbar from 'components/layout/navbar';
import { GeistSans } from 'geist/font';
import { ensureStartsWith } from 'lib/utils';
import { ReactNode, Suspense } from 'react';
import './globals.css';
import '../globals.css';

const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL
Expand Down
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.
330 changes: 160 additions & 170 deletions components/cart/modal.tsx

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions components/layout/navbar/index-without-cart-icon.tsx
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>
);
}

0 comments on commit b080326

Please sign in to comment.