product grid creating

This commit is contained in:
sdarbinyan
2026-07-05 01:36:21 +04:00
parent d2f0f0de54
commit 0efcfb5225
20 changed files with 951 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { DecimalPipe } from '@angular/common';
import { RouterLink } from '@angular/router';
import { Item } from '../../models';
import { Product } from '../../core/products/models/product-domain.model';
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
import { getBadgeClass, getDiscountedPrice, getMainImage } from '../../utils/item.utils';
@@ -16,7 +16,7 @@ export type ProductCardAppearance = 'standard' | 'compact';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ProductCardComponent {
@Input({ required: true }) item!: Item;
@Input({ required: true }) item!: Product;
@Input() title = '';
@Input() description = '';
@Input() addToCartLabel = 'Add to cart';
@@ -27,6 +27,7 @@ export class ProductCardComponent {
@Output() addToCart = new EventEmitter<{ itemID: number; event: Event }>();
@Output() preview = new EventEmitter<number>();
@Output() selected = new EventEmitter<{ itemID: number; event: Event }>();
readonly getMainImage = getMainImage;
readonly getDiscountedPrice = getDiscountedPrice;
@@ -35,4 +36,8 @@ export class ProductCardComponent {
onAddToCart(event: Event): void {
this.addToCart.emit({ itemID: this.item.itemID, event });
}
onSelected(event: Event): void {
this.selected.emit({ itemID: this.item.itemID, event });
}
}