DustinSchouten / FDND-Web-Design-Quotes-App

Dit project is gemaakt en bedoeld voor mensen die op zoek zijn naar inspirerende quotes die gaan over web design en web development. Het is een single page web app die volledig is gemaakt met HTML, CSS en JavaScript waarbij er gebruikgemaakt wordt van de fetch API om data op te halen. Vervolgens worden er op basis van de opgehaalde data quotes gegenereerd.
https://dustinschouten.github.io/FDND-Web-Design-Quotes-App/
Other
0 stars 0 forks source link

Feedback Sessie #1

Open Rascalov opened 2 years ago

Rascalov commented 2 years ago

Scan your buddy's repository

is there a repo description at the top?

Yes, but it's the forked WAFS description.

Is there a link to the live web app provided with GitHub Pages?

Yes

Is the repo open to issues?

Yes

Does it include a gitignore

Yes

Is the concept described well in the readme?

The read

Is the API described in the readme?

Only a link is shown.

Code

A lot of times, document.querySelector is used where a variable would be more readable and efficient.

  // Restart the animation
  document.querySelector('#quoteText').style.animation = 'none'
  document.querySelector('#quoteText').offsetHeight
  document.querySelector('#quoteText').style.animation = null
  // Animation restarted

You can set a local variable, or even global if you have to use it multiple functions.


lines 10,13, and 33 all finish with ; But since the rest of code does not, better remove these for consistency


Sometimes, javascript gives you a nicer alternative to if else blocks This code:

  if (avatarImgURL != '') { // Check if there is an image
    document.querySelector('.avatar').src = avatarImgURL
  }
  else { // If there is no image
    document.querySelector('.avatar').src = 'image_skeleton.png'
  }

Can be refactored to a short-circuit: document.querySelector('.avatar').src = (avatarImgURL || 'image_skeleton.png')

Declaring variables on top of the page improves readability a good amount.

The rest is nicely set up, you could make the fetching funtion async, but the current state implementation seems to flow nicely.

DustinSchouten commented 2 years ago

👍