Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 22, 2024
1 parent 38c3e2e commit 017c317
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
6 changes: 3 additions & 3 deletions src/css/favorities-exercise.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
padding: 5px 24px;
}

.js-list {
.list-favorites-item {
transition: transform cubic-bezier(0.4, 0, 0.2, 1), transform 0.1s;
}

.js-list:hover,
.js-list:focus {
.list-favorites-item:hover,
.list-favorites-item:focus {
transform: scale(1.05);
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.14), 0px 1px 3px rgba(0, 0, 0, 0.12), 0px 2px 1px rgba(0, 0, 0, 0.2);
}
Expand Down
2 changes: 0 additions & 2 deletions src/js/add-to-favorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ function updateGallery(cardID) {
}
}



function updateLicalStorage() {
return localStorage.getItem('addKeyID');
}
36 changes: 9 additions & 27 deletions src/js/favorities.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ function displayFavoriteCards(savedCards) {

}

// refs.galleryWindow.addEventListener('click', deleteFavorites);

// function deleteFavorites(e) {
// if (e.target.classList.contains('js-remove-favorites')) {
// const cardId = e.target.closest('.list-favorites-item').dataset.id;
// removeFavoriteCard(cardId);
// e.target.closest('.list-favorites-item').remove();

// const savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];
// if (savedCards.length === 0) {
// showRemoveCards();
// }
// }
// }

refs.galleryWindow.addEventListener('click', deleteFavorites);

function deleteFavorites(e) {
Expand All @@ -68,8 +53,6 @@ function deleteFavorites(e) {
}
}



function removeFavoriteCard(id) {
let savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];
savedCards = savedCards.filter(card => card !== id);
Expand All @@ -82,7 +65,6 @@ function showRemoveCards() {

function hideRemoveCards() {
refs.removeCards.classList.add("is-hidden");

}

function smoothScrollToNextGroup() {
Expand Down Expand Up @@ -125,7 +107,7 @@ export function createCardFavorites(arr) {
))
.then(results => {
const dataList = results.map(result => result.data);
const markup = createMarkup(dataList);
const markup = createMarkup(dataList)
const favoritesCard = document.getElementById('favorites-container');

// Перевіряємо, чи елемент favoritesCard існує
Expand Down Expand Up @@ -167,26 +149,26 @@ function createMarkup(arr) {
<use href="${icons}#icon-arrow-body-parts"></use>
</svg>
</button>
</div>
</div>
<div class="container-cards-favorites">
<svg class="icon-parts-fitness" width="24" height="24">
<use href="${icons}#icon-body-parts-fitness"></use>
</svg>
<h3 class="subtitle-favorites">${name.charAt(0).toUpperCase() + name.slice(1)
}</h3>
</div>
<div class="container-subtext-info">
<span class="favorites-card-text-wrapper">
<span class="subtext-info">Burned calories:</span>
<span class="mini-info">${burnedCalories}/ 3 min</span>
<div class="container-subtext-info">
<span class="favorites-card-text-wrapper">
<span class="subtext-info">Burned calories:</span>
<span class="mini-info">${burnedCalories}/ 3 min</span>
</span>
<span class="favorites-card-text-wrapper">
<span class="subtext-info">Body part:</span>
<span class="mini-info">${bodyPart}</span>
<span class="subtext-info">Body part:</span>
<span class="mini-info">${bodyPart}</span>
</span>
<span class="favorites-card-text-wrapper">
<span class="subtext-info">Target: </span>
<span class="mini-info">${target}</span>
<span class="mini-info">${target}</span>
</span>
</div>
</li>`)
Expand Down

0 comments on commit 017c317

Please sign in to comment.