mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-22 14:23:57 +00:00
BETTERZON-33: Product List Component Layout beta ready
This commit is contained in:
parent
3dbfcaa84d
commit
bb74e465da
|
@ -1,2 +1,2 @@
|
||||||
<app-product-list numberOfProducts="20" showProductPicture="true"></app-product-list>
|
<app-product-list numberOfProducts="20" [showProductPicture]="true"></app-product-list>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
<p>product-detail-page works! Product: {{productId}}</p>
|
<p>product-detail-page works! Product: {{productId}}</p>
|
||||||
|
<app-footer></app-footer>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* Div that contains each product */
|
||||||
.productItem {
|
.productItem {
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: dimgrey;
|
border-color: dimgrey;
|
||||||
|
@ -6,4 +7,49 @@
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
max-width: 50em;
|
max-width: 50em;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 10% 80% 10%;
|
||||||
|
grid-template-areas:
|
||||||
|
'image title price'
|
||||||
|
'image description price';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Image div */
|
||||||
|
.productImageContainer {
|
||||||
|
grid-area: image;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Product Image */
|
||||||
|
.productImage {
|
||||||
|
max-width: 50px;
|
||||||
|
max-height: 50px;
|
||||||
|
display:block;
|
||||||
|
margin: auto;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Title div */
|
||||||
|
.productTitle {
|
||||||
|
grid-area: title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Price div */
|
||||||
|
.productPrice {
|
||||||
|
grid-area: price;
|
||||||
|
text-align: center;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Price text */
|
||||||
|
.productPrice * {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Description div */
|
||||||
|
.productDescription {
|
||||||
|
grid-area: description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<div class="productItem" *ngFor="let product of products" (click)="clickedProduct(product)">
|
<div class="productItem" *ngFor="let product of products" (click)="clickedProduct(product)">
|
||||||
<div *ngIf="showProductPicture">
|
<div class="productImageContainer" *ngIf="showProductPicture===true">
|
||||||
{{product.image_guid}}
|
<img class="productImage" src="https://www.mueller-patrick.tech/betterzon/images/{{product.image_guid}}.jpg"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="productTitle">
|
||||||
{{product.name}}
|
<b>{{product.name}}</b>
|
||||||
|
</div>
|
||||||
|
<div class="productPrice">
|
||||||
|
5€
|
||||||
|
</div>
|
||||||
|
<div class="productDescription">
|
||||||
|
<div *ngIf="product.short_description.length > 300">
|
||||||
|
{{product.short_description.substring(0, 300) + "..."}}
|
||||||
|
</div>
|
||||||
|
<div *ngIf="product.short_description.length <= 300">
|
||||||
|
{{product.short_description}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
567
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,6 +12,7 @@ export class ProductListComponent implements OnInit {
|
||||||
products: Product[];
|
products: Product[];
|
||||||
@Input() numberOfProducts: number;
|
@Input() numberOfProducts: number;
|
||||||
@Input() showProductPicture: boolean;
|
@Input() showProductPicture: boolean;
|
||||||
|
type: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
|
@ -21,6 +22,7 @@ export class ProductListComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.getProducts();
|
this.getProducts();
|
||||||
|
console.log(this.showProductPicture);
|
||||||
|
|
||||||
if (!this.numberOfProducts) {
|
if (!this.numberOfProducts) {
|
||||||
this.numberOfProducts = 10;
|
this.numberOfProducts = 10;
|
||||||
|
@ -28,6 +30,9 @@ export class ProductListComponent implements OnInit {
|
||||||
if (!this.showProductPicture) {
|
if (!this.showProductPicture) {
|
||||||
this.showProductPicture = false;
|
this.showProductPicture = false;
|
||||||
}
|
}
|
||||||
|
this.type = 'PLP';
|
||||||
|
|
||||||
|
console.log(this.showProductPicture);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProducts(): void {
|
getProducts(): void {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user