Skip to content

Commit

Permalink
fix: ajuste do icone de favorito
Browse files Browse the repository at this point in the history
  • Loading branch information
inovaprog committed Oct 15, 2024
1 parent ab173c1 commit 07b056a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions assets/css/dark_mode.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions assets/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,16 @@ function insertCardsIntoHtml(data) {
}" id="${cardId}">
<div class="card__header">
<h3 class="card__title">${card.title}</h3>
<img
<i
alt="star"
unique-title="${cardId}"
id="fav_${cardId}"
src="${
card.tags.includes("Favoritos")
? starIconFilled
: starIcon
}"
class="fav__button"
/>
class="${
card.tags.includes("Favoritos")
? "ph-fill ph-star"
: "ph ph-star"
} fav__button">
</i>
</div>
<p class="card__description">${card.description}</p>
`;
Expand Down Expand Up @@ -266,10 +265,10 @@ function setCardAsFavorite(cardId) {
const favIcon = document.querySelector(`#fav_${cardId}`);

if (favoriteCards.includes(cardId)) {
favIcon.src = starIcon;
favIcon.className = "ph ph-star fav__button";
favoriteCards.splice(favoriteCards.indexOf(cardId), 1);
} else {
favIcon.src = starIconFilled;
favIcon.className = "ph-fill ph-star fav__button";
favoriteCards.push(cardId);
}

Expand Down

0 comments on commit 07b056a

Please sign in to comment.