-
Notifications
You must be signed in to change notification settings - Fork 1
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
Открывается и закрывается (часть 2) #10
base: master
Are you sure you want to change the base?
Conversation
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
|
||
const closePostModal = () => { | ||
postModal.classList.add('hidden'); | ||
closeModalBtn.removeEventListener('click', closePostModal); | ||
document.body.classList.remove('modal-open'); | ||
}; | ||
|
||
const clearComments = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
из названия функции не очевидно ее назначение
const insertPostComments = (commentsArr) => { | ||
const checkCommentsLength = () => { | ||
commentsCount.textContent = currentCount; | ||
if (commentsCount.textContent === commentsTotal.textContent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У вас есть глобальные переменные в которых хранятся значения из условия, используйте их
const insertPostComments = (newComments) => { | ||
comments = newComments; | ||
clearComments(); | ||
insertMoreComments(comments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переменная comments глобальная, нет нужды передавать ее в кач-ве параметра
postModal.querySelector('.social__comment-count').classList.add('hidden'); | ||
postModal.querySelector('.comments-loader').classList.add('hidden'); | ||
postComments.innerHTML = ''; | ||
clearComments(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Дублирование кода, вызов clearComments уже есть внутри insertPostComments
@@ -54,4 +81,6 @@ document.addEventListener('keydown', (evt) => { | |||
escKeypress(evt, closePostModal); | |||
}); | |||
|
|||
export {findPostContent}; | |||
loadMore.addEventListener('click', () => insertMoreComments(comments)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переменная comments глобальная, нет нужды передавать ее в кач-ве параметра
🎓 Открывается и закрывается (часть 2)
💥 https://htmlacademy-javascript.github.io/2358369-kekstagram-2/10/