Skip to content

Commit

Permalink
removed exra files and code. And Updated UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailendra Chauhan committed Sep 5, 2022
1 parent d9c43af commit 163eac1
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
"",
"\\app"
],
"PreviewInSolutionExplorer": false
}
Binary file not shown.
Empty file.
Binary file added .vs/labs/v17/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
47 changes: 16 additions & 31 deletions app/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
<div class="container my-5">
<div class="row">
<div class="col">
<h1 class="mb-4">Products Table</h1>

<h1 class="mb-4">Products List</h1>
<div class="input-group mb-3">
<input
type="text"
class="form-control"
placeholder="Search..."
(keyup)="search($event)"
/>
<input type="text" class="form-control" placeholder="Search..." (keyup)="search($event)" />
</div>

<div class="card mb-3" *ngIf="products">
<div class="card-body">
<table class="table" style="table-layout: fixed">
<thead>
<tr>
<th scope="col">Id</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Brand</th>
<th>Product Id</th>
<th>Title</th>
<th>Description</th>
<th>Brand</th>
<th>Display</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let product of products; index as i">
<td>{{ i + 1 + (page - 1) * pageSize }}</td>
<td>{{ product.id }}</td>
<td>{{ product.title }}</td>
<td>{{ product.description }}</td>
<td>{{ product.brand }}</td>
<td><img src="{{ product.thumbnail }}" /></td>
<td><img [src]="product.thumbnail" class="img-fluid"/></td>
</tr>
<tr *ngIf="!products.length">
<td colspan="5" class="text-center p-5">No records found</td>
Expand All @@ -39,27 +33,18 @@ <h1 class="mb-4">Products Table</h1>
</div>
</div>

<div class="d-flex justify-content-between p-2">
<ngb-pagination
[collectionSize]="collectionSize"
[(page)]="page"
[pageSize]="pageSize"
(pageChange)="refreshProducts()"
>
<!-- Paging Start -->
<div class="d-flex justify-content-between pt-2 pb-5">
<ngb-pagination [collectionSize]="collectionSize" [(page)]="page" [pageSize]="pageSize"
(pageChange)="refreshProducts()">
</ngb-pagination>
<select
class="form-select"
style="width: auto"
[(ngModel)]="pageSize"
(ngModelChange)="refreshProducts()"
>
<select class="form-select" style="width: auto" [(ngModel)]="pageSize" (ngModelChange)="refreshProducts()">
<option [ngValue]="5">5 items per page</option>
<option [ngValue]="10">10 items per page</option>
<option [ngValue]="15">15 items per page</option>
</select>
</div>
<!-- Paging End -->
</div>
</div>
</div>

<router-outlet></router-outlet>
</div>
4 changes: 0 additions & 4 deletions app/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
img {
width: 100px;
height: 100px;
}
35 changes: 0 additions & 35 deletions app/src/app/app.component.spec.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ProductsService } from 'src/services/products.service';
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
title = 'app';
products: Product[] = [];
page = 1;
collectionSize = 0;
Expand Down
1 change: 1 addition & 0 deletions app/src/models/product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface Product {
id: number;
title: string;
description: string;
price: number;
Expand Down
16 changes: 0 additions & 16 deletions app/src/services/products.service.spec.ts

This file was deleted.

0 comments on commit 163eac1

Please sign in to comment.