Skip to content

Commit

Permalink
module7 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfxllen committed Dec 10, 2024
1 parent 91d1301 commit da998ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions js/data.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {getARandomNumber} from './utils.js';

Check warning on line 1 in js/data.js

View workflow job for this annotation

GitHub Actions / Check

Strings must use doublequote
import {names, comments, descriptions} from './constants.js';

Check warning on line 2 in js/data.js

View workflow job for this annotation

GitHub Actions / Check

Strings must use doublequote
export function createArrayOfPhotos(){
const photos = [];
export function createArrayOfPictures(){
const pictures = [];
for (let i = 0; i < 25; i++){
const newPhoto = {
const newPicture = {
id : i + 1,
url: `photos/${i + 1}.jpg`,
description: descriptions[getARandomNumber(descriptions.length)],
likes: getARandomNumber(200, 15),
comments: createArrayOfComments(),
};
photos.push(newPhoto);
pictures.push(newPicture);
}
return photos;
return pictures;
}

export function createArrayOfComments(){
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {generatePictures} from './photos.js';
import {generatePictures} from './pictures.js';

generatePictures();
6 changes: 3 additions & 3 deletions js/photos.js → js/pictures.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {createArrayOfPhotos} from "./data.js";
import {createArrayOfPictures} from "./data.js";

export function generatePictures(){
const picturesContainer = document.querySelector(".pictures");
const pictureTemplate = document.querySelector("#picture").content.querySelector(".picture");
const pictureFragment = document.createDocumentFragment();

const photos = createArrayOfPhotos();
const pictures = createArrayOfPictures();

photos.forEach((photo) => {
pictures.forEach((photo) => {
const {url, description, comments, likes} = photo;
const picture = pictureTemplate.cloneNode(true);

Expand Down

0 comments on commit da998ba

Please sign in to comment.