File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1+ import './thumbnails' ;
2+
13const MIN_COUNT_ID = 1 ;
24const MAX_COUNT_ID = 25 ;
35const MAX_LENGTH_IMAGES = 25 ;
@@ -71,7 +73,7 @@ function getCommentsList(maxLength) {
7173 return commentsList ;
7274}
7375
74- function getImageList ( maxLength = MAX_LENGTH_IMAGES ) {
76+ export function getImageList ( maxLength = MAX_LENGTH_IMAGES ) {
7577 const imagesList = [ ] ;
7678
7779 for ( let i = 0 ; i < maxLength ; i ++ ) {
Original file line number Diff line number Diff line change 1+ import { getImageList } from './main' ;
2+
3+ const miniature = document . querySelector ( '#picture' ) . content ;
4+
5+ const renderMiniature = ( dataUser ) => {
6+ const newMiniature = miniature . cloneNode ( true ) ;
7+ const imagePath = newMiniature . querySelector ( '.picture__img' ) ;
8+ const likes = newMiniature . querySelector ( '.picture__likes' ) ;
9+ const comments = newMiniature . querySelector ( '.picture__comments' ) ;
10+
11+ imagePath . src = dataUser . url ;
12+ likes . textContent = dataUser . likes ;
13+ comments . textContent = dataUser . comments . length ;
14+
15+ return newMiniature ;
16+ } ;
17+
18+ const fragment = document . createDocumentFragment ( ) ;
19+ const imageList = getImageList ( ) ;
20+
21+ const renderListMiniature = ( list ) => {
22+ list . forEach ( ( image ) => {
23+ fragment . appendChild ( renderMiniature ( image ) ) ;
24+ } ) ;
25+
26+ const pictureContainer = document . querySelector ( '.pictures' ) ;
27+ if ( pictureContainer ) {
28+ pictureContainer . appendChild ( fragment ) ;
29+ }
30+ } ;
31+
32+ renderListMiniature ( imageList ) ;
You can’t perform that action at this time.
0 commit comments