-
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.
refactor: updated filters for projects
- Loading branch information
1 parent
1ebe88e
commit 7ffc62f
Showing
2 changed files
with
24 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const refs = { | ||
buttonsFilter: document.querySelectorAll('.filters-list button'), | ||
projects: document.querySelectorAll('.grid-portfolio__item'), | ||
}; | ||
|
||
refs.buttonsFilter.forEach(button => { | ||
button.addEventListener('click', () => { | ||
const btnCategory = button.dataset.category; | ||
|
||
refs.projects.forEach(project => { | ||
const projectCategory = project.dataset.category; | ||
if (btnCategory === 'all' || btnCategory === projectCategory) { | ||
return (project.style.display = 'block'); | ||
} | ||
return (project.style.display = 'none'); | ||
}); | ||
}); | ||
}); |
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