-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionado recurso de filtro na página de categorias para selecionar livros por categorias como front-end, back-end ou dados.
- Loading branch information
1 parent
8a5d8c9
commit 98335b7
Showing
4 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const botoes = document.querySelectorAll('.btn'); | ||
|
||
botoes.forEach(btn => btn.addEventListener('click', filtrarLivros)); | ||
|
||
function filtrarLivros() { | ||
const elementoBtn = document.getElementById(this.id); | ||
const categoria = elementoBtn.value; | ||
let livrosFiltrados = livros.filter(livro => livro.categoria == categoria); | ||
exibirOsLivrosNaTela(livrosFiltrados); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98335b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
alurabooks – ./
alurabooks-git-main-wellingtonfernandes.vercel.app
alurabooks-wells.vercel.app
alurabooks-wellingtonfernandes.vercel.app