diff --git a/components/cart/actions.ts b/components/cart/actions.ts index 7de539550..ea39c38a4 100644 --- a/components/cart/actions.ts +++ b/components/cart/actions.ts @@ -1,13 +1,7 @@ 'use server'; import { TAGS } from 'lib/constants'; -import { - addToCart, - createCart, - getCart, - removeFromCart, - updateCart, -} from 'lib/shopify'; +import { addToCart, createCart, getCart, removeFromCart, updateCart } from 'lib/shopify'; import { revalidateTag } from 'next/cache'; import { cookies } from 'next/headers'; @@ -30,9 +24,7 @@ export async function addItem(prevState: any, selectedVariantId: string) { } try { - await addToCart(cartId, [ - { merchandiseId: selectedVariantId, quantity: 1 } - ]); + await addToCart(cartId, [{ merchandiseId: selectedVariantId, quantity: 1 }]); revalidateTag(TAGS.cart); } catch (e) { return 'Error adding item to cart'; @@ -81,7 +73,7 @@ export async function updateItemQuantity( { id: lineId, merchandiseId: variantId, - quantity, + quantity } ]); revalidateTag(TAGS.cart); diff --git a/components/cart/add-to-cart.tsx b/components/cart/add-to-cart.tsx index c8907a520..87cb54787 100644 --- a/components/cart/add-to-cart.tsx +++ b/components/cart/add-to-cart.tsx @@ -58,11 +58,7 @@ function SubmitButton({ })} >
- {pending ? ( - - ) : ( - - )} + {pending ? : }
Add To Cart @@ -89,10 +85,7 @@ export function AddToCart({ return (
- +

{message}

diff --git a/components/cart/delete-item-button.tsx b/components/cart/delete-item-button.tsx index a53550013..378e85caa 100644 --- a/components/cart/delete-item-button.tsx +++ b/components/cart/delete-item-button.tsx @@ -13,21 +13,23 @@ import { function SubmitButton() { const { pending } = useFormStatus(); - + return ( ); @@ -35,7 +37,7 @@ function SubmitButton() { export function DeleteItemButton({ item }: { item: CartItem }) { const [message, formAction] = useFormState(removeItem, null); - const itemId = item.id; + const itemId = item.id; const actionWithVariant = formAction.bind(null, itemId); return ( diff --git a/components/cart/edit-item-quantity-button.tsx b/components/cart/edit-item-quantity-button.tsx index 7e14d6b2e..0ed902615 100644 --- a/components/cart/edit-item-quantity-button.tsx +++ b/components/cart/edit-item-quantity-button.tsx @@ -8,7 +8,7 @@ import type { CartItem } from 'lib/shopify/types'; import { // @ts-ignore experimental_useFormState as useFormState, - experimental_useFormStatus as useFormStatus, + experimental_useFormStatus as useFormStatus } from 'react-dom'; function SubmitButton({ type }: { type: 'plus' | 'minus' }) { @@ -16,49 +16,41 @@ function SubmitButton({ type }: { type: 'plus' | 'minus' }) { return ( ); } -export function EditItemQuantityButton({ - item, - type, -}: { - item: CartItem; - type: 'plus' | 'minus'; -}) { +export function EditItemQuantityButton({ item, type }: { item: CartItem; type: 'plus' | 'minus' }) { const [message, formAction] = useFormState(updateItemQuantity, null); const payload = { lineId: item.id, variantId: item.merchandise.id, - quantity: type === 'plus' ? item.quantity + 1 : item.quantity - 1, + quantity: type === 'plus' ? item.quantity + 1 : item.quantity - 1 }; const actionWithVariant = formAction.bind(null, payload); return ( -

+

{message}

diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index 23c5a0d00..6c60e6959 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -59,7 +59,7 @@ export default async function Footer() {

Designed in California

- Crafted by ▲ Vercel + Crafted by ▲ Vercel

diff --git a/components/layout/search/filter/index.tsx b/components/layout/search/filter/index.tsx index 7365d226d..33a36c6da 100644 --- a/components/layout/search/filter/index.tsx +++ b/components/layout/search/filter/index.tsx @@ -19,7 +19,11 @@ export default function FilterList({ list, title }: { list: ListItem[]; title?: return ( <>