-
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
Открывается и закрывается #7
Открывается и закрывается #7
Conversation
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
js/bigPosts.js
Outdated
@@ -0,0 +1,62 @@ | |||
import { getPosts } from './data.js'; | |||
|
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.
js/bigPosts.js название файлов/папок - в kebab-case
js/bigPosts.js
Outdated
const bigPicture = document.querySelector('.big-picture'); | ||
const commentsContainer = bigPicture.querySelector('.social__comments'); | ||
const closeBigPicture = bigPicture.querySelector('.big-picture__cancel'); | ||
const postsList = getPosts(); |
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.
мы НЕ получаем новый список, мы используем тот что уже получили в мейне
js/bigPosts.js
Outdated
const closeBigPicture = bigPicture.querySelector('.big-picture__cancel'); | ||
const postsList = getPosts(); | ||
|
||
const openBigPicture = (pictureId) => { |
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 closeBigPictureOnEsc = (event) => { | ||
if (event.key === 'Escape') { |
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.
в утилс функция на проверку ескейпа
js/main.js
Outdated
render(postsList); | ||
|
||
// Добавляю обработчик событий на контейнер с постами | ||
const container = document.querySelector('.pictures'); |
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 commentsContainer = bigPicture.querySelector('.social__comments'); | ||
const closeBigPicture = bigPicture.querySelector('.big-picture__cancel'); | ||
const container = document.querySelector('.pictures'); | ||
|
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.
название файла не забудь поменять на корректное и в kebab-case
const bigPictureHandler = (generatedPosts) => { | ||
initBigPictureEvents(); | ||
|
||
container.addEventListener('click', (evt) => { |
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.
выглядит так что это тоже входит в функцию initBigPictureEvents
🎓 Открывается и закрывается
💥 https://htmlacademy-javascript.github.io/2305513-kekstagram-2/7/