Skip to content

Commit

Permalink
raiteng
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 12, 2024
1 parent ed099a0 commit 296ee53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Binary file removed src/img/gif.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/js/body-parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function renderExercises(data) {
<span class="ex-item-head-group">
<span class="ex-item-workout">WORKOUT</span>
<span class="ex-rating-group">
<span class="ex-item-rating">${Number(i.rating).toFixed(1)}</span>
<span class="ex-item-rating">${Math.round(i.rating).toFixed(1)}</span>
<svg class="ex-star-icon" width="18" height="18"><use href="${icons}#icon-rating-star"></use></svg>
</span>
</span>
Expand Down
10 changes: 6 additions & 4 deletions src/js/modal-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,25 @@ function getExercisesObject(id) {
descriptionValue: document.querySelector('.js-description'),
}

const ratingPage = parseFloat(rating);
let fixedRating = Math.round(rating).toFixed(1)

const stars = document.querySelectorAll('.raiting-item .icon-star');

stars.forEach((star, index) => {
if (index < Math.floor(ratingPage)) {
if (index < Math.floor(fixedRating)) {
star.classList.remove('non-activ');
} else if (index === Math.floor(ratingPage) && ratingPage % 1 !== 0) {
} else if (index === Math.floor(fixedRating) && fixedRating % 1 !== 0) {
star.classList.remove('non-activ');
} else {
star.classList.add('non-activ');
}
});



refs.img.setAttribute('src', gifUrl);
refs.title.textContent = name;
refs.raiting.textContent = rating;
refs.raiting.textContent = fixedRating;
refs.targetValue.textContent = target;
refs.bodyPartValue.textContent = bodyPart;
refs.equipmentValue.textContent = equipment;
Expand Down

0 comments on commit 296ee53

Please sign in to comment.