add bill summary section

This commit is contained in:
2026-05-07 09:01:11 +05:30
parent b41e91d326
commit 3997001c98
2 changed files with 40 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import type { ComputedBill } from "../types";
import { formatCurrency } from "../utils";
interface BillSummaryProps {
bill: ComputedBill;
}
export function BillSummary({ bill }: BillSummaryProps) {
if (bill.items.length === 0) return null;
return (
<div className="p-4 rounded-2xl bg-white shadow-sm">
<div className="flex flex-col gap-2">
<div className="flex justify-between text-sm text-gray-500">
<span>Subtotal</span>
<span>{formatCurrency(bill.subtotal, bill.currency)}</span>
</div>
{bill.taxPercent > 0 && (
<div className="flex justify-between text-sm text-gray-500">
<span>
{bill.taxType} {bill.taxPercent}%
</span>
<span>{formatCurrency(bill.taxAmount, bill.currency)}</span>
</div>
)}
<div className="border-t border-gray-100 mt-1 pt-2 flex justify-between items-center">
<span className="font-bold text-gray-800">Total</span>
<span className="font-bold text-indigo-600 text-lg">
{formatCurrency(bill.total, bill.currency)}
</span>
</div>
</div>
</div>
);
}