-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ a1a3d69 🚀
- Loading branch information
1 parent
ad86a6e
commit d8e8f01
Showing
8 changed files
with
154 additions
and
147 deletions.
There are no files selected for viewing
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 27 additions & 21 deletions
48
assets/favorites-3ce64fd3.js → assets/favorites-9a7feb98.js
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 |
---|---|---|
@@ -1,65 +1,71 @@ | ||
import{i}from"./sprite-70ed1671.js";const d=document.querySelector(".favorites__list"),v=document.getElementById("favoritesButton");v.addEventListener("click",l());function l(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t!==null){d.innerHTML="";const e=t.map(({_id:a,name:s,burnedCalories:r,bodyPart:c,target:n})=>` | ||
import{i as s}from"./05-modal-exercises-65434497.js";const d=document.querySelector(".favorites__list"),l=document.getElementById("favoritesButton");l.addEventListener("click",v());function v(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t.length!==0){d.innerHTML="";const a=t.map(({_id:e,name:r,burnedCalories:c,bodyPart:i,target:o})=>` | ||
<li class="fav-filters__item-card"> | ||
<div class="fav-card__wrap"> | ||
<div class="fav-card__block-btn"> | ||
<div class="fav-card__trash-btn-wrap"> | ||
<p class="fav-card__badge">Workout</p> | ||
<button class="fav-card__btn js-remove-btn" data-id="${a}" type="button"> | ||
<button class="fav-card__btn js-remove-btn" data-id="${e}" type="button"> | ||
<svg class="fav-card__btn-trash-svg" width="16" height="16"> | ||
<use href="${i}#icon-trash"></use> | ||
<use href="${s}#icon-trash"></use> | ||
</svg> | ||
</button> | ||
</div> | ||
<button class="fav-card__btn-start" data-id="${a}" type="button">Start | ||
<button class="fav-card__btn-start card__btn" data-id="${e}" type="button">Start | ||
<svg class="fav-card__btn-start-svg" width="16" height="16"> | ||
<use href="${i}#icon-arrow"></use> | ||
<use href="${s}#icon-arrow"></use> | ||
</svg> | ||
</button> | ||
</div> | ||
<div class="fav-card__title-wrap"> | ||
<svg class="fav-card__title-svg" width="24" height="24"> | ||
<use href="${i}#icon-running-stick-figure"></use> | ||
<use href="${s}#icon-running-stick-figure"></use> | ||
</svg> | ||
<h2 class="fav-card__title">${s}</h2> | ||
<h2 class="fav-card__title">${r}</h2> | ||
</div> | ||
<div class="fav-card__block-info"> | ||
<p class="fav-card__text-info"><span>Burned calories:</span>${r}</p> | ||
<p class="fav-card__text-info"><span>Body part:</span>${c}</p> | ||
<p class="fav-card__text-info"><span>Target:</span>${n}</p> | ||
<p class="fav-card__text-info"><span>Burned calories:</span>${c}</p> | ||
<p class="fav-card__text-info"><span>Body part:</span>${i}</p> | ||
<p class="fav-card__text-info"><span>Target:</span>${o}</p> | ||
</div> | ||
</div> | ||
</li>`).join("");d.insertAdjacentHTML("beforeend",e)}}const o=document.querySelector(".favorites__list");o.addEventListener("click",_);function _(t){if(!t.target.closest(".js-remove-btn"))return;const e=t.target.closest(".js-remove-btn").getAttribute("data-id"),s=JSON.parse(localStorage.getItem("exerciseData")).filter(r=>r._id!==e);localStorage.setItem("exerciseData",JSON.stringify(s)),f(s)}function f(t){if(t.length!==0){o.innerHTML="";const e=t.map(({_id:a,name:s,burnedCalories:r,bodyPart:c,target:n})=>` | ||
</li>`).join("");d.insertAdjacentHTML("beforeend",a)}}const n=document.querySelector(".favorites__list");n.addEventListener("click",_);function _(t){if(!t.target.closest(".js-remove-btn"))return;const a=t.target.closest(".js-remove-btn").getAttribute("data-id"),r=JSON.parse(localStorage.getItem("exerciseData")).filter(c=>c._id!==a);localStorage.setItem("exerciseData",JSON.stringify(r)),f()}function f(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t.length===0){n.innerHTML="";const a=` | ||
<li class="favorites__empty"> | ||
It appears that you haven't added any exercises to your favorites | ||
yet. To get started, you can add exercises that you like to your | ||
favorites for easier access in the future. | ||
</li> | ||
`;n.insertAdjacentHTML("beforeend",a)}else{n.innerHTML="";const a=t.map(({_id:e,name:r,burnedCalories:c,bodyPart:i,target:o})=>` | ||
<li class="fav-filters__item-card"> | ||
<div class="fav-card__wrap"> | ||
<div class="fav-card__block-btn"> | ||
<div class="fav-card__trash-btn-wrap"> | ||
<p class="fav-card__badge">Workout</p> | ||
<button class="fav-card__btn js-remove-btn" data-id="${a}" type="button"> | ||
<button class="fav-card__btn js-remove-btn" data-id="${e}" type="button"> | ||
<svg class="fav-card__btn-trash-svg" width="16" height="16"> | ||
<use href="${icons}#icon-trash"></use> | ||
<use href="${s}#icon-trash"></use> | ||
</svg> | ||
</button> | ||
</div> | ||
<button class="fav-card__btn-start" data-id="${a}" type="button">Start | ||
<button class="fav-card__btn-start card__btn" data-id="${e}" type="button">Start | ||
<svg class="fav-card__btn-start-svg" width="16" height="16"> | ||
<use href="${icons}#icon-arrow"></use> | ||
<use href="${s}#icon-arrow"></use> | ||
</svg> | ||
</button> | ||
</div> | ||
<div class="fav-card__title-wrap"> | ||
<svg class="fav-card__title-svg" width="24" height="24"> | ||
<use href="${icons}#icon-running-stick-figure"></use> | ||
<use href="${s}#icon-running-stick-figure"></use> | ||
</svg> | ||
<h2 class="fav-card__title">${s}</h2> | ||
<h2 class="fav-card__title">${r}</h2> | ||
</div> | ||
<div class="fav-card__block-info"> | ||
<p class="fav-card__text-info"><span>Burned calories:</span>${r}</p> | ||
<p class="fav-card__text-info"><span>Body part:</span>${c}</p> | ||
<p class="fav-card__text-info"><span>Target:</span>${n}</p> | ||
<p class="fav-card__text-info"><span>Burned calories:</span>${c}</p> | ||
<p class="fav-card__text-info"><span>Body part:</span>${i}</p> | ||
<p class="fav-card__text-info"><span>Target:</span>${o}</p> | ||
</div> | ||
</div> | ||
</li>`).join("");o.insertAdjacentHTML("beforeend",e)}} | ||
</li>`).join("");n.insertAdjacentHTML("beforeend",a)}} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.