Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Happy thoughts Josefin R #438

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

JosefinRobertsson
Copy link

No description provided.

Copy link

@dannebrob dannebrob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on the project! Overall a well done project, it shows that you understand useEffect and React,
Added a few comments below, but no big things. Be proud!


useEffect(() => {
updateThoughtsList();
// eslint-disable-next-line react-hooks/exhaustive-deps

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you didn't use eslint-disable in the whole file? Makes it easier (in my own opinion) to remove if necessary in the top level of the file.

return (
<div className="inputForm">
<form onSubmit={handleFormSubmit}>
<h3>What&apos;s making you happy right now?</h3>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&apos
Nice use off Predefined Character Entities (had to look up that name😅 )

Comment on lines 5 to 15
const SingleThought = ({ thought, onHeartClick }) => {
const date = new Date(thought.createdAt);
const timeDiff = Math.round((new Date() - date) / (1000 * 60));
if (timeDiff < 1) {
timeStamp = 'just now';
} else if (timeDiff < 90) {
timeStamp = `${timeDiff} min ago`;
} else {
const hoursDiff = Math.round(timeDiff / 60);
timeStamp = `${hoursDiff} hour${hoursDiff > 1 ? 's' : ''} ago`;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very nice structured function; Its easy to understand.

onChange={handleInputChange}
maxLength="140" />
<div id="counter">140/{charCount}</div>
<button type="submit"><span id="heart"> Send Happy Thought&nbsp;</span></button>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to add a feature that disables the send button if a value (<= 5) is entered in the text box;, to prevent a error message from the API, that gets rendered out in the DataList component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants