import { formatPrice } from "../lib/format"; import type { TaxBreakdownGroup } from "../lib/taxBreakdown"; // The actual amount of VAT included in a total — not just a disclosure // that VAT is included (see cartTotals.ts's effectiveTaxRate() for the // "which %" shown next to each line item elsewhere). One line per rate // when a cart/order spans more than one; a single line otherwise. Each // line is a flex row with a spacer (same "label, flex-1 spacer, value" // shape as every other Zwischensumme/Versand/Gesamtsumme row in the // sidebars this renders inside) so every € amount lands on the same // right-hand edge — a plain "X%: Y €" text line left the amount starting // wherever the rate's own digit count happened to end, visibly misaligned // as soon as two different rates (e.g. "7%" vs "19%") were both present. export function VatBreakdown({ groups }: { groups: TaxBreakdownGroup[] }) { if (groups.length === 0) return null; if (groups.length === 1) { const [g] = groups; return (
enthält {g.rate}% MwSt. {formatPrice(g.tax)}
); } return (

enthält MwSt.:

{groups.map((g) => (
{g.rate}% {formatPrice(g.tax)}
))}
); }