Skip to content

Commit

Permalink
поправленный поп ыт
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelUd committed Nov 13, 2023
1 parent cc72bb0 commit 7c4f7ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const MESSAGES = ['', 'Всё отлично!В целом всё неплохо
'Я поскользнулся на банановой кожуре и уронил фотоаппарат на кота и у меня получилась фотография лучше.',
'Лица у людей на фотке перекошены, как будто их избивают. Как можно было поймать такой неудачный момент?!'];
const NAMES= ['Aboba', 'MegaGrib', 'Nagibator3000', 'Artem', 'Ghg', 'top_php_progger'];
const PHOTOS_COUNT = 25;
const PHOTOS_COUNT = 26;
const MAX_COMMENTS_COUNT = 30;
const LikesCount = {
MIN: 15,
Expand Down
4 changes: 4 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import {getPhotoDescriptions} from './data.js';
import {thumbnailsRender} from './thumbnails-renderer.js';


const photos = getPhotoDescriptions();
thumbnailsRender(photos);
16 changes: 10 additions & 6 deletions js/thumbnails-renderer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getPhotoDescriptions} from './data.js';
let photos = null;

const NULL_INDEX = 0;
const templatePicture = document.querySelector('#picture').content;
Expand All @@ -14,9 +14,13 @@ const getPicture = (photo) =>{
return picture;
};

const photos = getPhotoDescriptions();
photos.forEach((photo, index) => {
if(index > NULL_INDEX){
pictures.appendChild(getPicture(photo));
export const thumbnailsRender = (data) =>{
photos = data.slice();
if(photos){
photos.forEach((photo, index) => {
if(index > NULL_INDEX){
pictures.appendChild(getPicture(photo));
}
});
}
});
};

0 comments on commit 7c4f7ff

Please sign in to comment.