diff --git a/components/cart/close-cart.tsx b/components/cart/close-cart.tsx new file mode 100644 index 000000000..782d14ef6 --- /dev/null +++ b/components/cart/close-cart.tsx @@ -0,0 +1,10 @@ +import { XMarkIcon } from '@heroicons/react/24/outline'; +import clsx from 'clsx'; + +export default function CartIcon({ className }: { className?: string }) { + return ( +
+ +
+ ); +} diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx index b96ae5c5b..f07479d57 100644 --- a/components/cart/modal.tsx +++ b/components/cart/modal.tsx @@ -2,7 +2,6 @@ import { Dialog, Transition } from '@headlessui/react'; import { ShoppingCartIcon } from '@heroicons/react/24/outline'; -import CartIcon from 'components/icons/cart'; import Price from 'components/price'; import { DEFAULT_OPTION } from 'lib/constants'; import type { Cart } from 'lib/shopify/types'; @@ -11,8 +10,10 @@ import Image from 'next/image'; import Link from 'next/link'; import { Fragment, useEffect, useRef, useState } from 'react'; import { useCookies } from 'react-cookie'; +import CloseCart from './close-cart'; import DeleteItemButton from './delete-item-button'; import EditItemQuantityButton from './edit-item-quantity-button'; +import OpenCart from './open-cart'; type MerchandiseSearchParams = { [key: string]: string; @@ -52,7 +53,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU return ( <> @@ -81,7 +82,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU

My Cart

diff --git a/components/icons/cart.tsx b/components/cart/open-cart.tsx similarity index 57% rename from components/icons/cart.tsx rename to components/cart/open-cart.tsx index e2212627c..a9e379868 100644 --- a/components/icons/cart.tsx +++ b/components/cart/open-cart.tsx @@ -1,24 +1,18 @@ -import { ShoppingCartIcon, XMarkIcon } from '@heroicons/react/24/outline'; +import { ShoppingCartIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; export default function CartIcon({ className, - quantity, - icon + quantity }: { className?: string; quantity?: number; - icon?: string; }) { return (
- {icon === 'close' ? ( - - ) : ( - - )} + {quantity ? (
diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx index ba483a2cc..2ea9e3ce8 100644 --- a/components/layout/navbar/index.tsx +++ b/components/layout/navbar/index.tsx @@ -1,5 +1,5 @@ import Cart from 'components/cart'; -import CartIcon from 'components/icons/cart'; +import OpenCart from 'components/cart/open-cart'; import LogoSquare from 'components/logo-square'; import { getMenu } from 'lib/shopify'; import { Menu } from 'lib/shopify/types'; @@ -48,7 +48,7 @@ export default async function Navbar() {
- }> + }>