createReviewHTML(review) {
    const li = document.createElement('li');

    const nameDateParagraph = document.createElement('p');
    const nameSpan = document.createElement('span');
    const dateSpan = document.createElement('span');
    nameSpan.innerHTML = review.name;
    nameSpan.classList.add('reviewer-name');
    const creationDate = new Date(review.createdAt);
    dateSpan.innerHTML = `${creationDate.toLocaleDateString()} ${creationDate.getHours()}:${creationDate.getMinutes()}`;
    dateSpan.classList.add('reviewer-date');
    nameDateParagraph.appendChild(nameSpan);
    nameDateParagraph.appendChild(dateSpan);
    nameDateParagraph.classList.add('reviewer-name-date')
    li.appendChild(nameDateParagraph);

    if ('onLine' in navigator && !navigator.onLine && review.offline) {
      const offlineInfo = document.createElement('p');
      offlineInfo.innerHTML = 'Saved offline';
      offlineInfo.classList.add('reviewer-offline-info');
      li.appendChild(offlineInfo);
    }

    const rating = document.createElement('p');
    const ratingSpan = document.createElement('span');
    ratingSpan.innerHTML = `Rating: ${review.rating}`;
    ratingSpan.classList.add('reviewer-rating-badge');
    rating.appendChild(ratingSpan);
    rating.classList.add('reviewer-rating');
    li.appendChild(rating);

    const comments = document.createElement('p');
    comments.innerHTML = review.comments;
    comments.classList.add('reviewer-comments');
    li.appendChild(comments);

    return li;
  }
/**
   * Create review HTML and add it to the webpage.
   */
Create review HTML and add it to the webpage.
Create review HTML and add it to the webpage .
createReviewHTML(review) {
    const li = document.createElement('li');
    const nameDateParagraph = document.createElement('p');
    const nameSpan = document.createElement('span');
    const dateSpan = document.createElement('span');
    nameSpan.innerHTML = review.name;
    nameSpan.classList.add('reviewer-name');
    const creationDate = new Date(review.createdAt);
    dateSpan.innerHTML = `${creationDate.toLocaleDateString()} ${creationDate.getHours()}:${creationDate.getMinutes()}`;
    dateSpan.classList.add('reviewer-date');
    nameDateParagraph.appendChild(nameSpan);
    nameDateParagraph.appendChild(dateSpan);
    nameDateParagraph.classList.add('reviewer-name-date')
    li.appendChild(nameDateParagraph);
    if ('onLine' in navigator && !navigator.onLine && review.offline) {
      const offlineInfo = document.createElement('p');
      offlineInfo.innerHTML = 'Saved offline';
      offlineInfo.classList.add('reviewer-offline-info');
      li.appendChild(offlineInfo);
    }
    const rating = document.createElement('p');
    const ratingSpan = document.createElement('span');
    ratingSpan.innerHTML = `Rating: ${review.rating}`;
    ratingSpan.classList.add('reviewer-rating-badge');
    rating.appendChild(ratingSpan);
    rating.classList.add('reviewer-rating');
    li.appendChild(rating);
    const comments = document.createElement('p');
    comments.innerHTML = review.comments;
    comments.classList.add('reviewer-comments');
    li.appendChild(comments);
    return li;
  }
createReviewHTML ( review ) { const li = document . createElement ( 'li' ) ; const nameDateParagraph = document . createElement ( 'p' ) ; const nameSpan = document . createElement ( 'span' ) ; const dateSpan = document . createElement ( 'span' ) ; nameSpan . innerHTML = review . name ; nameSpan . classList . add ( 'reviewer-name' ) ; const creationDate = new Date ( review . createdAt ) ; dateSpan . innerHTML = ` ${ creationDate . toLocaleDateString ( ) } ${ creationDate . getHours ( ) } ${ creationDate . getMinutes ( ) } ` ; dateSpan . classList . add ( 'reviewer-date' ) ; nameDateParagraph . appendChild ( nameSpan ) ; nameDateParagraph . appendChild ( dateSpan ) ; nameDateParagraph . classList . add ( 'reviewer-name-date' ) li . appendChild ( nameDateParagraph ) ; if ( 'onLine' in navigator && ! navigator . onLine && review . offline ) { const offlineInfo = document . createElement ( 'p' ) ; offlineInfo . innerHTML = 'Saved offline' ; offlineInfo . classList . add ( 'reviewer-offline-info' ) ; li . appendChild ( offlineInfo ) ; } const rating = document . createElement ( 'p' ) ; const ratingSpan = document . createElement ( 'span' ) ; ratingSpan . innerHTML = ` ${ review . rating } ` ; ratingSpan . classList . add ( 'reviewer-rating-badge' ) ; rating . appendChild ( ratingSpan ) ; rating . classList . add ( 'reviewer-rating' ) ; li . appendChild ( rating ) ; const comments = document . createElement ( 'p' ) ; comments . innerHTML = review . comments ; comments . classList . add ( 'reviewer-comments' ) ; li . appendChild ( comments ) ; return li ; }
Create review HTML and add it to the webpage.
Create review HTML and add it to the webpage .