feat: implement cart icon component with quantity badge and integrate into store header for improved UI
This commit is contained in:
19
src/app/shared/components/cart-icon/cart-icon.component.ts
Normal file
19
src/app/shared/components/cart-icon/cart-icon.component.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cart-icon',
|
||||
imports: [],
|
||||
templateUrl: './cart-icon.component.html',
|
||||
styleUrl: './cart-icon.component.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class CartIconComponent {
|
||||
readonly quantity = input<number | null | undefined>(undefined);
|
||||
readonly disabled = input(false);
|
||||
readonly ariaLabel = input<string>('Carrito de compras');
|
||||
|
||||
protected readonly hasQuantity = computed(() => {
|
||||
const q = this.quantity();
|
||||
return q !== null && q !== undefined && q > 0;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user