diff --git a/src/css/rating-popup.css b/src/css/rating-popup.css index f5585f4..65599cd 100644 --- a/src/css/rating-popup.css +++ b/src/css/rating-popup.css @@ -62,6 +62,16 @@ fill: var(--rating-color); } +.modal-rating__rating polygon:hover { + cursor: pointer; + fill: var(--accent-color); + transition: all var(--tran-icon); +} + +.modal-rating__rating polygon.active { + fill: var(--accent-color); +} + .modal-rating__form { display: flex; flex-direction: column; diff --git a/src/js/exercise-popup.js b/src/js/exercise-popup.js index 3dc75bd..38639bd 100644 --- a/src/js/exercise-popup.js +++ b/src/js/exercise-popup.js @@ -214,7 +214,7 @@ function showModalExercise() { function closeModalExercise() { overlay.classList.add('hidden'); modalExercise.classList.add('hidden'); - document.body.style.overflow = 'scroll'; + document.body.style.overflow = 'auto'; overlay.removeEventListener('click', clickOnOverlay); document.removeEventListener('keydown', clickOnEscape); }; \ No newline at end of file diff --git a/src/js/rating-popup.js b/src/js/rating-popup.js index 8932692..515eb2b 100644 --- a/src/js/rating-popup.js +++ b/src/js/rating-popup.js @@ -9,8 +9,10 @@ export function openModalRating() { modalRating.innerHTML = markUp(); showModalRating(); - const closeModalRatingButton = document.querySelector('.js-modal-rating__btn-close'); + const closeModalRatingButton = document.querySelector('.js-modal-rating__btn-close'); + const starsIcons = document.querySelector('.js-stars-svg'); closeModalRatingButton.addEventListener('click', closeModalRating); + starsIcons.addEventListener('click', changeStarsRating) }; function showModalRating() { @@ -23,6 +25,16 @@ function closeModalRating() { modalRating.classList.add('hidden'); }; +function changeStarsRating(e) { + const starsIcons = document.querySelector('.js-stars-svg'); + let value = e.target.dataset.value; + value && (starsIcons.parentNode.dataset.value = value); + starsIcons.querySelectorAll('polygon').forEach(star => { + let on = starsIcons.parentNode.dataset.value >= star.dataset.value; + star.classList.toggle('active', on); + }); +}; + function markUp() { return `