Files
medreport_mrb2b/app/home/(user)/_components/cart/cart-item.tsx
2025-09-10 06:34:34 +03:00

57 lines
1.4 KiB
TypeScript

"use client"
import { HttpTypes } from "@medusajs/types"
import { useTranslation } from "react-i18next"
import {
TableCell,
TableRow,
} from '@kit/ui/table';
import { formatCurrency } from "@/packages/shared/src/utils"
import CartItemDelete from "./cart-item-delete";
export default function CartItem({ item, currencyCode }: {
item: HttpTypes.StoreCartLineItem
currencyCode: string
}) {
const { i18n: { language } } = useTranslation();
return (
<TableRow className="w-full" data-testid="product-row">
<TableCell className="text-left w-[100%] px-4 sm:px-6">
<p
className="txt-medium-plus text-ui-fg-base"
data-testid="product-title"
>
{item.product_title}
</p>
</TableCell>
<TableCell className="px-4 sm:px-6">
{item.quantity}
</TableCell>
<TableCell className="min-w-[80px] px-4 sm:px-6">
{formatCurrency({
value: item.unit_price,
currencyCode,
locale: language,
})}
</TableCell>
<TableCell className="min-w-[80px] px-4 sm:px-6 text-right">
{formatCurrency({
value: item.total,
currencyCode,
locale: language,
})}
</TableCell>
<TableCell className="text-right px-4 sm:px-6">
<span className="flex gap-x-1 justify-end w-[60px]">
<CartItemDelete id={item.id} />
</span>
</TableCell>
</TableRow>
)
}