Vitron-Front/app/components/cart/CartSummary.tsx
2026-04-29 01:44:16 +03:30

38 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Loader2 } from "lucide-react";
import { formatPrice } from "../../utils/helpers";
import { Button } from "../ui/button";
interface CartSummaryProps {
total: string;
onContinue: () => void;
step: number;
isLoading: boolean;
}
export const CartSummary = ({
total,
onContinue,
step,
isLoading,
}: CartSummaryProps) => (
<div className="max-w-md mx-auto fixed flex flex-row gap-2 w-full bottom-[50px] left-0 right-0 border-t py-1 px-2 z-50 bg-WHITE">
<Button
variant="dark"
size="lg"
className="w-full flex-1 font-bold bg-VITROWN_BLUE active:bg-VITROWN_BLUE hover:bg-VITROWN_BLUE text-white"
onClick={onContinue}
disabled={isLoading}
>
{isLoading && <Loader2 className="w-4 h-4 animate-spin" />}
{step === 0 || step === 1 ? "ثبت و ادامه" : "تایید و پرداخت"}
</Button>
<div className="flex-1 gap-2 w-full flex flex-col items-center justify-center">
<p className="text-B14 font-bold text-GRAY">مبلغ کل فاکتور:</p>
<p className="text-B14 font-bold">{formatPrice(total)} تومان</p>
{step === 2 && (
<p className="text-R10 text-GRAY">۱۰٪ مالیات به مبلغ نهایی اضافه میشود</p>
)}
</div>
</div>
);