fix: Add promoted item to cart

This commit is contained in:
Sol Irvine
2023-09-01 14:54:27 -07:00
parent bd4cabd16c
commit 725a43505a
18 changed files with 167 additions and 101 deletions

View File

@@ -3,14 +3,20 @@ import CartModal from 'components/cart/modal';
import FacebookIcon from 'components/icons/facebook';
import InstagramIcon from 'components/icons/instagram';
import KanjiLogo from 'components/icons/kanji';
import { Cart } from 'lib/shopify/types';
import { Cart, Product } from 'lib/shopify/types';
import Link from 'next/link';
import FooterMenu from './footer-menu';
import NewsletterFooter from './newsletter-footer';
const { COMPANY_NAME, SITE_NAME } = process.env;
export default async function Footer({ cart }: { cart?: Cart }) {
export default async function Footer({
cart,
promotedItem
}: {
cart?: Cart;
promotedItem?: Product;
}) {
const currentYear = new Date().getFullYear();
const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : '');
const copyrightName = COMPANY_NAME || SITE_NAME || '';
@@ -89,7 +95,7 @@ export default async function Footer({ cart }: { cart?: Cart }) {
<div className="flex flex-col space-y-2 pt-24">
<div className="flex flex-row justify-between space-x-4">
<CartModal cart={cart} />
<CartModal cart={cart} promotedItem={promotedItem} />
<div className="flex flex-row items-center space-x-6">
<Link
href="https://www.instagram.com/suginomoribrewery/"

View File

@@ -4,11 +4,9 @@ import { Transition } from '@headlessui/react';
import { ChevronUpIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx';
import CartModal from 'components/cart/modal';
import OpenCart from 'components/cart/open-cart';
import LogoNamemark from 'components/icons/namemark';
import { Cart, Product } from 'lib/shopify/types';
import Link from 'next/link';
import { Suspense } from 'react';
import { useInView } from 'react-intersection-observer';
import { MenuModal } from '../menu/modal';
import { LanguageControl, SupportedLocale } from './language-control';
@@ -63,12 +61,10 @@ export default function Navbar({
</Link>
</div>
<nav className="flex flex-row items-center space-x-4 px-6">
<Suspense fallback={<OpenCart />}>
<div className="flex flex-col-reverse items-center justify-center space-y-2 px-2 md:flex-row md:space-x-6">
<CartModal cart={cart} promotedItem={promotedItem} />
<MenuModal scrolled={!inView} />
</div>
</Suspense>
<div className="flex flex-col-reverse items-center justify-center space-y-2 px-2 md:flex-row md:space-x-6">
<CartModal cart={cart} promotedItem={promotedItem} />
<MenuModal scrolled={!inView} />
</div>
</nav>
</div>
</Transition>
@@ -92,9 +88,7 @@ export default function Navbar({
<LanguageControl lang={locale} />
</div>
<div className="flex flex-col-reverse items-center justify-center space-y-2 rounded md:flex-row md:space-x-6 md:space-y-0">
<Suspense fallback={<OpenCart />}>
<CartModal cart={cart} promotedItem={promotedItem} />
</Suspense>
<CartModal cart={cart} promotedItem={promotedItem} />
<MenuModal scrolled={!inView} />
</div>
</nav>