Files
Dominik Ferber db89f0dfb1 Init
2024-12-12 13:01:06 +02:00

18 lines
569 B
TypeScript

import { allocate, toUnit, up, type Dinero } from 'dinero.js';
import { ProductCurrencySymbol } from '#/components/product-currency-symbol';
export const ProductSplitPayments = ({ price }: { price: Dinero<number> }) => {
// only offer split payments for more expensive items
if (toUnit(price) < 150) {
return null;
}
const [perMonth] = allocate(price, [1, 2]);
return (
<div className="text-sm text-gray-400">
Or <ProductCurrencySymbol dinero={price} />
{toUnit(perMonth, { digits: 0, round: up })}/month for 3 months
</div>
);
};