Skip to content

Commit

Permalink
Сделал дз #6 Отрисуй меня полностью
Browse files Browse the repository at this point in the history
  • Loading branch information
generalofgotei committed Dec 9, 2024
1 parent 7833bda commit 9d18483
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
10 changes: 5 additions & 5 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const isWithinWorkingHours = (workdayStart, workdayEnd, meetingStart, meetingLen
return meetingStartMinutes >= workdayStartMinutes && meetingEndMinutes <= workdayEndMinutes
};

console.log(isWithinWorkingHours('08:00', '17:30', '14:00', 90));
console.log(isWithinWorkingHours('8:0', '10:0', '8:0', 120));
console.log(isWithinWorkingHours('08:00', '14:30', '14:00', 90));
console.log(isWithinWorkingHours('14:00', '17:30', '08:0', 90));
console.log(isWithinWorkingHours('8:00', '17:30', '08:00', 900));
// console.log(isWithinWorkingHours('08:00', '17:30', '14:00', 90));
// console.log(isWithinWorkingHours('8:0', '10:0', '8:0', 120));
// console.log(isWithinWorkingHours('08:00', '14:30', '14:00', 90));
// console.log(isWithinWorkingHours('14:00', '17:30', '08:0', 90));
// console.log(isWithinWorkingHours('8:00', '17:30', '08:00', 900));
7 changes: 3 additions & 4 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
generateArrObj
} from './data.js';
renderGallery
} from './thumbnails.js';

// Проверка вывода и работы. Удалить перед сдачей.
console.table(generateArrObj());
renderGallery();
28 changes: 28 additions & 0 deletions js/renderGallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
generateArrObj
} from './data.js';

const renderGallery = () => {
const picturesContainer = document.querySelector('.pictures');
const pictureTemplate = document.querySelector('#picture')
.content
.querySelector('a');

const userPictures = generateArrObj();
const pictureFragment = document.createDocumentFragment();

userPictures.forEach(({id, url, description, likes, comments}) => {
const pictureElement = pictureTemplate.cloneNode(true);
pictureElement.querySelector('.picture__img').src = url;
pictureElement.querySelector('.picture__img').alt = description;
pictureElement.querySelector('.picture__likes').textContent = likes;
pictureElement.querySelector('.picture__comments').textContent = comments.length;
pictureFragment.append(pictureElement)
});

const renderThumbnails = picturesContainer.append(pictureFragment);
};

export {
renderGallery
};
28 changes: 28 additions & 0 deletions js/thumbnails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
generateArrObj
} from './data.js';

const renderGallery = () => {
const picturesContainer = document.querySelector('.pictures');
const pictureTemplate = document.querySelector('#picture')
.content
.querySelector('a');

const userPictures = generateArrObj();
const pictureFragment = document.createDocumentFragment();

userPictures.forEach(({id, url, description, likes, comments}) => {
const pictureElement = pictureTemplate.cloneNode(true);
pictureElement.querySelector('.picture__img').src = url;
pictureElement.querySelector('.picture__img').alt = description;
pictureElement.querySelector('.picture__likes').textContent = likes;
pictureElement.querySelector('.picture__comments').textContent = comments.length;
pictureFragment.append(pictureElement);
});

picturesContainer.append(pictureFragment);
};

export {
renderGallery
};

0 comments on commit 9d18483

Please sign in to comment.