SOLUTION: JESÚS HERRERA & SOFÍA ROMERA#54
Open
Sofianct wants to merge 21 commits intoassembler-institute:mainfrom
Open
SOLUTION: JESÚS HERRERA & SOFÍA ROMERA#54Sofianct wants to merge 21 commits intoassembler-institute:mainfrom
Sofianct wants to merge 21 commits intoassembler-institute:mainfrom
Conversation
jose-cuevas
reviewed
May 17, 2022
| @@ -0,0 +1,109 @@ | |||
|
|
|||
| const postsURL = fetch("https://jsonplaceholder.typicode.com/posts/"); | |||
| const contentBody = document.getElementById('modal__body-content'); | |||
There was a problem hiding this comment.
Better use camel case notation for ID, and BEM notation for classes
jose-cuevas
reviewed
May 17, 2022
| postsURL | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| data.forEach(post => { |
There was a problem hiding this comment.
Better use map() method instead of forEach()
| commentBox.removeChild(commentBox.lastChild); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Don't delete your comments! Use them to organize and give titles to each section of your code :)
Comment on lines
+17
to
+34
| const mainContainer = document.getElementById('cards-container'); | ||
| const cardContainer = document.createElement('div'); | ||
| cardContainer.classList.add('card', 'container__card--post'); | ||
| const cardBody = document.createElement('div'); | ||
| cardBody.classList.add('card-body'); | ||
| const cardTitle = document.createElement('h5'); | ||
| cardTitle.classList.add('card-title'); | ||
| const titleLink = document.createElement('a'); | ||
| titleLink.classList.add('card__title--post') | ||
| titleLink.setAttribute('href','javaScript:void(0)') | ||
| titleLink.setAttribute('data-bs-toggle', 'modal') | ||
| titleLink.setAttribute('data-bs-target', '#exampleModal') | ||
| titleLink.textContent = post.title.charAt(0).toUpperCase() + post.title.slice(1); | ||
| const delIcon = document.createElement('i'); | ||
| const cardText = document.createElement('p'); | ||
| const addIcon = document.createElement('i'); | ||
| cardText.classList.add('card-text'); | ||
| cardText.textContent = (post.body.charAt(0).toUpperCase() + post.body.slice(1)).slice(0, 80) + '...'; |
There was a problem hiding this comment.
Try to put all your const "variables" together for better organisation.
| }); | ||
| }) | ||
| .catch(error => { | ||
| console.log(error); |
There was a problem hiding this comment.
Remeber to get rid of all the console.log's
jose-cuevas
reviewed
May 17, 2022
jose-cuevas
left a comment
There was a problem hiding this comment.
Clean code, easy to read to it, congrats!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.