Skip to content

Commit

Permalink
rating is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 27, 2024
1 parent f259df2 commit e7ae222
Show file tree
Hide file tree
Showing 5 changed files with 370 additions and 373 deletions.
8 changes: 0 additions & 8 deletions src/css/star.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ $starHue: 38;

:root {
--yellow: #{hsl($starHue,90%,55%)};
--yellow-t: #{hsla($starHue,90%,55%,0)};
--bezier: cubic-bezier(0.42,0,0.58,1);
--trans-dur: 0.3s;
}
Expand Down Expand Up @@ -113,13 +112,6 @@ $starHue: 38;
&__input-5:checked ~ &__label:nth-of-type(-n + 5) &__star-fill {
animation-name: starFill;
}
&__input-1:not(:checked):hover ~ &__label:first-of-type &__star-fill,
&__input-2:not(:checked):hover ~ &__label:nth-of-type(2) &__star-fill,
&__input-3:not(:checked):hover ~ &__label:nth-of-type(3) &__star-fill,
&__input-4:not(:checked):hover ~ &__label:nth-of-type(4) &__star-fill,
&__input-5:not(:checked):hover ~ &__label:nth-of-type(5) &__star-fill {
fill: var(--yellow-t);
}
// screen reader text
&__sr {
clip: rect(1px,1px,1px,1px);
Expand Down
2 changes: 1 addition & 1 deletion src/js/helper/get-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function patchAccess({ id, formData }) {
try {
const response = await axios.patch(
`https://energyflow.b.goit.study/api/exercises/${id}/rating`, formData);
iziToastFunctions.getSuccessInfo('Rating has been updated');
iziToastFunctions.getSuccessInfo('Thank you! Your opinion really important for us!');

return response;
}
Expand Down
5 changes: 5 additions & 0 deletions src/js/modal-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const refs = {
closeIcon: document.querySelector('.js-modal-window'),
galleryWindow: document.querySelector('.js-gallery'),
ratingBtn: document.querySelector('.js-open-rating'),
formRating: document.querySelector('.js-form'),
numberRating: document.querySelector('.js-rating'),
}
export let idExercises;

Expand Down Expand Up @@ -35,6 +37,9 @@ function closeModal() {
refs.backdrop.classList.add('is-open');
document.body.style.overflow = '';

refs.formRating.reset();
refs.numberRating.textContent = '0.0';

clearModalContent();
}

Expand Down
5 changes: 3 additions & 2 deletions src/js/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ refsRating.backdrop.addEventListener('click', function (event) {
}
});

export const timeToClose = () => setTimeout(() => closeModal(), 1500)
export const timeToClose = () => setTimeout(() => closeModal(), 1000)

// Функція відправки рейтенгу
refsRating.formRating.addEventListener('submit', sendRating)
Expand All @@ -80,8 +80,9 @@ function sendRating(event) {
formData: objectDate,
})
.then(() => {
timeToClose();
refsRating.formRating.reset();
refsRating.numberRating.textContent = '0.0';
timeToClose();
})
.catch((error) => {
console.log(error);
Expand Down
Loading

0 comments on commit e7ae222

Please sign in to comment.