diff --git a/client/src/entities/product/ui/ProductCard.tsx b/client/src/entities/product/ui/ProductCard.tsx index f15ced1..6752d95 100644 --- a/client/src/entities/product/ui/ProductCard.tsx +++ b/client/src/entities/product/ui/ProductCard.tsx @@ -40,21 +40,30 @@ export function ProductCard({ product, mediaHeight = 200, actions }: Props) { swiperRef.current.slideTo(idx, 0) } + const stockLabel = + product.inStock && product.quantity === 0 + ? { label: 'Нет в наличии', color: 'default' as const } + : !product.inStock + ? { label: `Под заказ · ${product.leadTimeDays ?? '—'} дн.`, color: 'warning' as const } + : null + return ( {imageUrls.length ? ( - + { swiperRef.current = s @@ -90,9 +99,10 @@ export function ProductCard({ product, mediaHeight = 200, actions }: Props) { height: mediaHeight, objectFit: 'cover', display: 'block', - transition: 'transform 240ms ease', + transition: 'transform 320ms ease', '@media (prefers-reduced-motion: reduce)': { transition: 'none' }, userSelect: 'none', + bgcolor: 'grey.50', }} /> @@ -103,62 +113,104 @@ export function ProductCard({ product, mediaHeight = 200, actions }: Props) { - Нет фото + + Нет фото + )} + + {stockLabel && ( + + )} - - - {product.category && } - {product.inStock && product.quantity === 0 && } - {!product.inStock && ( + + + + {product.category && ( )} + {product.title} + {(product.materials?.length ?? 0) > 0 && ( - + {materials.map((m) => ( - + ))} - {moreMaterials > 0 && } + {moreMaterials > 0 && ( + + )} )} + {product.shortDescription ?? 'Описание появится позже.'} - - {formatPriceRub(product.priceCents)} - - {actions} + + + + {formatPriceRub(product.priceCents)} + + {actions} +