mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
18 lines
569 B
TypeScript
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>
|
|
);
|
|
};
|