Skip to content

Commit

Permalink
feat: lessons 2-3 [ref:no-ref]
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Nazyrov committed May 27, 2021
1 parent b5c4779 commit ca6c0e9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export class ShopCardComponent {
@Output()
public decrement = new EventEmitter();

public incrementProductInCart() {
public incrementProductInCart(): void {
this.increment.emit();
}

public decrementProductInCart() {
public decrementProductInCart(): void {
this.decrement.emit();
}
}
2 changes: 1 addition & 1 deletion 1-components/2-footer/src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="footer-inner">
<div class="footer-menu"></div>
<div class="footer-title">
© ,
© {{currentYear}}, {{author}}
</div>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion 1-components/2-footer/src/app/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import {Component, ChangeDetectionStrategy, Output, Input} from '@angular/core';

@Component({
selector: 'ngx-shop-footer',
Expand All @@ -7,4 +7,7 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
})
export class FooterComponent {

public author = 'Angular Course';

public currentYear: number = new Date().getFullYear();
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
<div class="product-list-box">
<div class="inner-col description-col go-to-product">
<div class="inner-col description-col go-to-product" (click)="redirectTo()">
<div class="product-img pointer">
<img
loading="auto"
class="img"
width="80"
[src]="product?.image"
[alt]="product?.name"
/>
</div>

<div class="product-desc">
<h4 class="product-name col-title mb-2 pointer">

{{product?.name}}
</h4>
<p class="rate-amount d-none d-md-block mt-1">
{{product?.feedbacksCount}}
отзыва
</p>

<p class="price-text mb-0 mt-2 d-inline-block d-md-none">
<strong></strong>
<strong>{{product?.price}}€</strong>
</p>
</div>
</div>

<div class="default-col inner-col price-col actions">
<h4 class="col-title price-text mb-2"></h4>
<h4 class="col-title price-text mb-2">{{product?.price}}</h4>
<div class="button-wrap">
<button
type="button"
class="btn btn-outline-primary add-to-cart"
(click)="addToBasket()"
>
Добавить в корзину
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { Component, Input, Output, ChangeDetectionStrategy, EventEmitter } from '@angular/core';
import { IProduct} from '../../../../../shared/mocks/1-components/product';

@Component({
selector: 'ngx-shop-content-product',
templateUrl: './product-card.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CategoryProductComponent {}
export class CategoryProductComponent {
@Input()
public product: IProduct = {} as IProduct;

@Output()
public addToCart = new EventEmitter();

@Output()
public goToProduct = new EventEmitter();

public addToBasket(): void {
this.addToCart.emit();
}

public redirectTo(): void {
this.goToProduct.emit();
}
}

0 comments on commit ca6c0e9

Please sign in to comment.