Skip to content

Commit

Permalink
some edits
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 12, 2024
1 parent 296ee53 commit 06538bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/js/body-parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function renderExercises(data) {
let markup = data
.map(
i =>
`<li class="exercise-item" data-id="${i._id}">
`<li class="exercise-item js-id" data-id="${i._id}">
<div class="ex-item-head">
<span class="ex-item-head-group">
<span class="ex-item-workout">WORKOUT</span>
Expand All @@ -61,7 +61,7 @@ function renderExercises(data) {
</span>
<a class="ex-item-start" href="#" data-id="${i._id}">
<span class="js-start">Start</span>
<svg class="ex-arrow-icon" width="14" height="14"><use href="${icons}#arrow"></use></svg>
<svg class="ex-arrow-icon js-start" width="14" height="14"><use href="${icons}#arrow"></use></svg>
</a>
</div>
<span class="ex-title">
Expand Down
16 changes: 5 additions & 11 deletions src/js/modal-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { getAccess } from "./helper/get-access";

const backdrop = document.querySelector('.backdrop-thumb');
const closeIcon = document.querySelector('.js-modal-window');
const galleryWindow = document.querySelector('.exercises-card');
const galleryWindow = document.querySelector('.js-gallery');

galleryWindow.addEventListener('click', openModal);

// Відкриття модалки
function openModal(e) {
if (e.target.classList.contains('ex-arrow-icon') || e.target.classList.contains('js-start')) {
if (e.target.classList.contains('js-start')) {
backdrop.classList.remove('is-open');
document.body.style.overflow = 'hidden';

const liElement = e.target.closest('.exercise-item');
const liElement = e.target.closest('.js-id');

if (liElement) {
const id = liElement.dataset.id;
Expand Down Expand Up @@ -47,7 +47,7 @@ function getExercisesObject(id) {
descriptionValue: document.querySelector('.js-description'),
}

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

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

Expand All @@ -61,8 +61,6 @@ function getExercisesObject(id) {
}
});



refs.img.setAttribute('src', gifUrl);
refs.title.textContent = name;
refs.raiting.textContent = fixedRating;
Expand All @@ -73,10 +71,6 @@ function getExercisesObject(id) {
refs.caloriesValue.textContent = burnedCalories;
refs.descriptionValue.textContent = description;



})
.catch((err) => console.error(err));
}

// Рейтенг
}
2 changes: 1 addition & 1 deletion src/partials/exercises.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="exercises-header">Exercises</h2>
</form>
</div>
</div>
<ul class="gallery">
<ul class="gallery js-gallery">
<!--<li class="gallery-item></li>"-->
</ul>
</div>
Expand Down

0 comments on commit 06538bd

Please sign in to comment.