marketing/src/utils/product.ts

18 lines
512 B
TypeScript
Raw Normal View History

2026-08-24 10:07:16 +00:00
import type { Product } from '../types/cart';
export function normalizeProductImage(product: Product, size = '65,fit'): Product {
return {
...product,
image: product.image?.replace('{SIZE}', size),
};
}
export function getLargeProductImage(product: Product): string {
return product.image?.replace('65,fit', '335,fit') ?? '';
}
export function getProductAmount(product: Product): string {
return product.unit === 'g'
? `${product.n} г`
: `${product.n} шт`;
}