refactor: replace shopify imports

This commit is contained in:
Victor Gerbrands
2023-05-02 15:42:35 +02:00
parent 7021789621
commit 3ab0bd18d0
20 changed files with 45 additions and 45 deletions

View File

@@ -6,7 +6,7 @@ import { useCookies } from 'react-cookie';
import CartIcon from 'components/icons/cart';
import CartModal from './modal';
import type { Cart } from 'lib/shopify/types';
import type { Cart } from 'lib/medusa/types';
export default function CartButton({
cart,

View File

@@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation';
import { startTransition, useState } from 'react';
import clsx from 'clsx';
import type { CartItem } from 'lib/shopify/types';
import type { CartItem } from 'lib/medusa/types';
export default function DeleteItemButton({ item }: { item: CartItem }) {
const router = useRouter();

View File

@@ -4,7 +4,7 @@ import { startTransition, useState } from 'react';
import clsx from 'clsx';
import MinusIcon from 'components/icons/minus';
import PlusIcon from 'components/icons/plus';
import type { CartItem } from 'lib/shopify/types';
import type { CartItem } from 'lib/medusa/types';
import LoadingDots from '../loading-dots';
export default function EditItemQuantityButton({

View File

@@ -1,4 +1,4 @@
import { createCart, getCart } from 'lib/shopify';
import { createCart, getCart } from 'lib/medusa';
import { cookies } from 'next/headers';
import CartButton from './button';

View File

@@ -7,7 +7,7 @@ import CloseIcon from 'components/icons/close';
import ShoppingBagIcon from 'components/icons/shopping-bag';
import Price from 'components/price';
import { DEFAULT_OPTION } from 'lib/constants';
import type { Cart } from 'lib/shopify/types';
import type { Cart } from 'lib/medusa/types';
import { createUrl } from 'lib/utils';
import DeleteItemButton from './delete-item-button';
import EditItemQuantityButton from './edit-item-quantity-button';
@@ -70,13 +70,13 @@ export default function CartModal({
</button>
</div>
{cart.lines.length === 0 ? (
{cart.lines?.length === 0 ? (
<div className="mt-20 flex w-full flex-col items-center justify-center overflow-hidden">
<ShoppingBagIcon className="h-16" />
<p className="mt-6 text-center text-2xl font-bold">Your cart is empty.</p>
</div>
) : null}
{cart.lines.length !== 0 ? (
{cart.lines?.length !== 0 ? (
<div className="flex h-full flex-col justify-between overflow-hidden">
<ul className="flex-grow overflow-auto p-6">
{cart.lines.map((item, i) => {