Skip to content

Commit

Permalink
Merge pull request #2 from LuisFrag/dev
Browse files Browse the repository at this point in the history
Merge new features and fix items
  • Loading branch information
Luis Fernando Poma Mamani authored May 27, 2020
2 parents e8e0514 + 344f21a commit 6b288ae
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/app/layout/content/content.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<main role="main" class="inner cover cover-container mx-auto">
<img
src="../../../assets/search_book_light_transparent.png"
class="img-fluid"
/>
<img src="assets/search_book_light_transparent.png" class="img-fluid" />
<p class="lead font-weight-light font-italic">
Find the books you are looking for anywhere
</p>
Expand Down
12 changes: 10 additions & 2 deletions src/app/layout/content/list/list.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="cover-container-card mx-auto">
<div class="text-center">
<p class="lead" *ngIf="loading">Loading...</p>
</div>
<div class="my-2 text-left" *ngIf="dataBooks != undefined">
<p class="text-light">
About
Expand All @@ -10,16 +13,21 @@
<div class="col-12 col-md-6 col-lg-4 mb-3" *ngFor="let book of books">
<div class="card text-dark">
<img
[src]="book.imageLinks.thumbnail"
src="{{
book.imageLinks != undefined
? book.imageLinks.thumbnail
: 'assets/not-found.png'
}}"
class="card-img-top"
height="350"
alt="..."
/>

<div class="card-body text-left">
<small
class="card-text text-muted d-inline-block text-truncate"
style="max-width: 210px;"
>{{ book.authors[0] }}</small
>{{ book.authors }}</small
>
<p class="card-title h7 my-0">
{{ book.title }}
Expand Down
20 changes: 14 additions & 6 deletions src/app/layout/content/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ export class ListComponent implements OnInit {
constructor(private bookService: BooksService) {
this.books = [];
}
book: any;
loading: boolean;
ngOnInit(): void {}

search(searchValue: string) {
this.bookService.getBooks(searchValue).then((books: DataSet) => {
this.dataBooks = books;
books.items.forEach((book: BookSearchInfos) => {
this.books.push(book.volumeInfo);
this.books = [];
this.dataBooks = null;
this.loading = true;
this.bookService
.getBooks(searchValue.split(' ').join('+'))
.then((books: DataSet) => {
this.dataBooks = books;
books.items.forEach((book: BookSearchInfos) => {
this.books.push(book.volumeInfo);
});
this.loading = false;
});
});

console.log(this.books);
}
}
Binary file added src/assets/not-found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
url: 'https://www.googleapis.com/books/v1',
};

0 comments on commit 6b288ae

Please sign in to comment.