Skip to content

Commit

Permalink
feat: add home page books grid
Browse files Browse the repository at this point in the history
  • Loading branch information
joseandrestrujillo committed Nov 22, 2023
1 parent bfb1a96 commit ef56fdb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export default function Home() {
import BookGrid from '@/components/BookGrid/BookGrid'
import { findBooks } from '@/core/book/infrastructure/actions'

export default async function Home() {
const books = await findBooks()
return (
<main>
<p>Lo sentimos, aún no hay libros :-(</p>
<BookGrid books={books} />
</main>
)
}
2 changes: 1 addition & 1 deletion src/core/book/infrastructure/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import container from '@/lib/container'

import { FindBookResponse } from '../application/types'

export async function findBooks(): Promise<FindBookResponse[] | null> {
export async function findBooks(): Promise<FindBookResponse[]> {
return container.findBooks.with()
}
20 changes: 10 additions & 10 deletions src/core/book/infrastructure/services/books-in-memory.retository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class BooksInMemory implements Books {
{
authors: ['Donald Knuth'],
id: '1',
image: 'url_to_image1',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'The Art of Computer Programming',
},
{
Expand All @@ -18,43 +18,43 @@ export default class BooksInMemory implements Books {
'John Vlissides',
],
id: '2',
image: 'url_to_image2',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Design Patterns: Elements of Reusable Object-Oriented Software',
},
{
authors: ['Martin Fowler'],
id: '3',
image: 'url_to_image3',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Refactoring: Improving the Design of Existing Code',
},
{
authors: ['Andrew S. Tanenbaum'],
id: '4',
image: 'url_to_image4',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Computer Networks',
},
{
authors: ['Robert C. Martin'],
id: '5',
image: 'url_to_image5',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Clean Code: A Handbook of Agile Software Craftsmanship',
},
{
authors: ['Bjarne Stroustrup'],
id: '6',
image: 'url_to_image6',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'The C++ Programming Language',
},
{
authors: ['Brian W. Kernighan', 'Dennis M. Ritchie'],
id: '7',
image: 'url_to_image7',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'The C Programming Language',
},
{
authors: ['Eric S. Raymond'],
id: '8',
image: 'url_to_image8',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'The Cathedral and the Bazaar',
},
{
Expand All @@ -65,13 +65,13 @@ export default class BooksInMemory implements Books {
'Jeffrey D. Ullman',
],
id: '9',
image: 'url_to_image9',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Compilers: Principles, Techniques, and Tools',
},
{
authors: ['Douglas C. Schmidt'],
id: '10',
image: 'url_to_image10',
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
title: 'Pattern-Oriented Software Architecture',
},
]
Expand Down

0 comments on commit ef56fdb

Please sign in to comment.