diff --git a/frontend/app/components/books/BookCard.tsx b/frontend/app/components/books/BookCard.tsx index 0e4b19ba..7eb2a3d0 100644 --- a/frontend/app/components/books/BookCard.tsx +++ b/frontend/app/components/books/BookCard.tsx @@ -18,7 +18,6 @@ const BookCard = ({ book }: BookCardProps) => { @@ -26,7 +25,13 @@ const BookCard = ({ book }: BookCardProps) => { - {!!user && } + {!!user && ( + + )} ); }; diff --git a/frontend/app/components/books/BookCardCartButton.tsx b/frontend/app/components/books/BookCardCartButton.tsx index fb564e78..57fa666f 100644 --- a/frontend/app/components/books/BookCardCartButton.tsx +++ b/frontend/app/components/books/BookCardCartButton.tsx @@ -2,17 +2,22 @@ import { Button } from '@mantine/core'; import { useAtom } from 'jotai'; import { BiSolidCartAdd } from 'react-icons/bi'; import { cartAtom } from '~/stores/cartAtom'; -import { addBookToCart } from '~/utils/cart'; +import { addBooksToCart } from '~/utils/cart'; interface BookCardCartButtonProps { id: number; stock: number; + thumbnail?: string; } -const BookCardCartButton = ({ id, stock }: BookCardCartButtonProps) => { +const BookCardCartButton = ({ + id, + stock, + thumbnail, +}: BookCardCartButtonProps) => { const [cart, setCart] = useAtom(cartAtom); const addCart = () => { - setCart(addBookToCart(cart, id, stock)); + setCart(addBooksToCart(cart, [{ id, stock, thumbnail }])); }; return (