BETTERZON-42: Restructuring, creating necessary components, design of Product detail component

This commit is contained in:
2020-12-09 07:51:08 +01:00
34 changed files with 508 additions and 40 deletions
@@ -0,0 +1,3 @@
<app-header></app-header>
<app-product-list numberOfProducts="20" [showProductPicture]="true"></app-product-list>
<app-footer></app-footer>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LandingpageComponent } from './landingpage.component';
describe('LandingpageComponent', () => {
let component: LandingpageComponent;
let fixture: ComponentFixture<LandingpageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LandingpageComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LandingpageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-landingpage',
templateUrl: './landingpage.component.html',
styleUrls: ['./landingpage.component.css']
})
export class LandingpageComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
@@ -0,0 +1,3 @@
<app-header></app-header>
<app-product-details [productId]="productId"></app-product-details>
<app-footer></app-footer>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductDetailPageComponent } from './product-detail-page.component';
describe('ProductDetailPageComponent', () => {
let component: ProductDetailPageComponent;
let fixture: ComponentFixture<ProductDetailPageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProductDetailPageComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProductDetailPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,21 @@
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
@Component({
selector: 'app-product-detail-page',
templateUrl: './product-detail-page.component.html',
styleUrls: ['./product-detail-page.component.css']
})
export class ProductDetailPageComponent implements OnInit {
productId: string;
constructor(
private router: Router
) {
this.productId = router.url.substr(9, router.url.length);
}
ngOnInit(): void {
}
}
@@ -0,0 +1,3 @@
<app-header></app-header>
<app-product-list numberOfProducts="20" [showProductPicture]="true"></app-product-list>
<app-footer></app-footer>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductSearchPageComponent } from './product-search-page.component';
describe('ProductSearchPageComponent', () => {
let component: ProductSearchPageComponent;
let fixture: ComponentFixture<ProductSearchPageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProductSearchPageComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProductSearchPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,21 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-product-search-page',
templateUrl: './product-search-page.component.html',
styleUrls: ['./product-search-page.component.css']
})
export class ProductSearchPageComponent implements OnInit {
searchTerm: string;
constructor(
private route: ActivatedRoute
) {
}
ngOnInit(): void {
this.searchTerm = this.route.snapshot.queryParamMap.get('q');
}
}