Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Открывается и закрывается #12

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

Daniil888-m
Copy link
Contributor

@Daniil888-m Daniil888-m commented Dec 11, 2024

@keksobot keksobot changed the title Module8 task1 Открывается и закрывается Dec 11, 2024
keksobot pushed a commit that referenced this pull request Dec 11, 2024
@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

bigPhotoPopup.querySelector('.social__comment-shown-count').textContent = currentPhoto.comments.length;
bigPhotoPopup.querySelector('.social__comment-total-count').textContent = currentPhoto.comments.length;
bigPhotoPopup.querySelector('.social__comments').innerHTML = '';
bigPhotoPopup.querySelector('.social__comments').append(comments);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чтобы функция renderComments соответствовала своему названию, лучше перенести инструкции на 61, 62 строке внутрь нее

}

function renderComments(photoId) {
const currentPhoto = photos.find((photo) => photo.id === Number(photoId));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так как внутри функции openBigPhotoPopup извлекается объект с данными о фото, в renderComments можно передавать массив с комментариями для того чтобы не запускать цикл .find лишний раз

@keksobot keksobot merged commit 2bc7856 into htmlacademy-javascript:master Dec 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants