Conversation
| document.getElementById('text-from-post').value = ''; | ||
| document.getElementById('writer-posted').value = ''; |
There was a problem hiding this comment.
what is the purpose of this?
Better practice is to extract to a function to help with readability and reusability
|
|
||
|
|
||
| const textFromPost = document.getElementById('text-from-post').value; | ||
| const writerPosted = document.getElementById('writer-posted').value; | ||
|
|
||
| postToAdd(textFromPost, writerPosted); | ||
|
|
||
|
|
There was a problem hiding this comment.
watch for all these empty spaces
| const textFromPost = document.getElementById('text-from-post').value; | |
| const writerPosted = document.getElementById('writer-posted').value; | |
| postToAdd(textFromPost, writerPosted); | |
| const textFromPost = document.getElementById('text-from-post').value; | |
| const writerPosted = document.getElementById('writer-posted').value; | |
| postToAdd(textFromPost, writerPosted); |
| <input type="text" class="form-control" id="text-from-post" placeholder="Post Text"> | ||
| </div> | ||
| <div class="form-group"> | ||
| <input type="text" class="form-control" id="writer-posted" placeholder="Your Name"> |
There was a problem hiding this comment.
not a great id text, I would have used:
| <input type="text" class="form-control" id="writer-posted" placeholder="Your Name"> | |
| <input type="text" class="form-control" id="post-author-input" placeholder="Your Name"> |
| <div id="cont-posts"></div> | ||
| <form class="module-2" id="form-post" > | ||
| <div class="form-group"> | ||
| <input type="text" class="form-control" id="text-from-post" placeholder="Post Text"> |
There was a problem hiding this comment.
the id needs to reflect the element, not the result of the value:
| <input type="text" class="form-control" id="text-from-post" placeholder="Post Text"> | |
| <input type="text" class="form-control" id="post-text-input" placeholder="Post Text"> |
| messagesPost.textContent = `${post} - Posted by ${writer}`; | ||
|
|
||
|
|
||
| const withdrawMessagesHere = document.createElement('a'); |
There was a problem hiding this comment.
bad and not clear const name. Took me a while to understand what this is doing.
Whats wrong with removeMessagesElement/container?
| withdrawMessagesHere.href = '#'; | ||
| withdrawMessagesHere.textContent = 'remove'; | ||
| withdrawMessagesHere.classList.add('text-danger', 'mr-2'); | ||
| withdrawMessagesHere.addEventListener('click', function () { |
There was a problem hiding this comment.
you are using es6 with consts, but not with functions
| }); | ||
|
|
||
| // Fxn to make post add to page html | ||
| function postToAdd(post, writer) { |
There was a problem hiding this comment.
not arrow function, stick to es6
| }); | ||
|
|
||
|
|
||
| const postSwitchFromPage = document.createElement('a'); |
There was a problem hiding this comment.
same as above, this const name is confusing.
showHideCommentsAction or something is better.
| }); | ||
|
|
||
|
|
||
| const messagesAreHere = document.createElement('div'); |
There was a problem hiding this comment.
| const messagesAreHere = document.createElement('div'); | |
| const messagesContainer = document.createElement('div'); |
There was a problem hiding this comment.
You call them messages, but what are they messages or posts? Be consistent!
No description provided.