Skip to content

Happy thoughts - Julia#51

Open
julialindstrand wants to merge 7 commits intoTechnigo:mainfrom
julialindstrand:main
Open

Happy thoughts - Julia#51
julialindstrand wants to merge 7 commits intoTechnigo:mainfrom
julialindstrand:main

Conversation

@julialindstrand
Copy link

Copy link

@Appilistus Appilistus left a comment

Choose a reason for hiding this comment

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

Great job Julia! The app looks good and works as it should. I think you covered most of the requirements (only the lighthouse score is missing). The code is clean and easy to follow. It's great that you've managed to build the app with such a small number of components! I added some comments about accessibility, hope it helps. But overall you have done a good job! well done!

Comment on lines +10 to +27
useEffect(() => {
const init = async () => {
// RECEIVING also called GETing
const response = await fetch("https://happy-thoughts-api-4ful.onrender.com/thoughts")

const returnedResponseValueInJSON = await response.json()

const newArrayWithThoughts = returnedResponseValueInJSON.map((item) => {
return {
id: item._id,
likes: item.hearts,
text: item.message,
createdAt: item.createdAt
}
})

setThoughts(newArrayWithThoughts)
}

Choose a reason for hiding this comment

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

It would be good to add error handling in case API fetch doesn't work:)

Choose a reason for hiding this comment

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

Yes I agree, that would be a good addition! :)

)
<>
<GlobalStyle />
<AppWrapper className="AppWrapper">

Choose a reason for hiding this comment

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

Does this need to have className?:)

@@ -0,0 +1,96 @@
import React, { useState } from "react"

Choose a reason for hiding this comment

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

Any reason to import React here?:)

Comment on lines +36 to +42
<Input
rows={3}
value={text}
onChange={handleChange}
maxLength={MAX_LEN}
name="text"
/>

Choose a reason for hiding this comment

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

Lighthouse is warning about there is no label here. You might wanna add aria-label for better accessibility:)


const Counter = styled.p`
font-size: 15px;
color: #c9c8c8;

Choose a reason for hiding this comment

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

Lighthouse complains about the color contrast here. You need to change the color darker for better accessibility:)

)
}

const Span = styled.span`

Choose a reason for hiding this comment

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

The font size might be a bit too small.

}

const Span = styled.span`
float: right;

Choose a reason for hiding this comment

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

I havent seen float in a while! :) It's not considered deprecated, but barely anyone uses it any more. Try to use flex or grid instead and float can cause issues if not handled correctly. In this case it works fine though!

src/App.jsx Outdated
useEffect(() => {
const init = async () => {
// RECEIVING also called GETing
const response = await fetch("https://happy-thoughts-api-4ful.onrender.com/thoughts")

Choose a reason for hiding this comment

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

A good thing is to have stuff like text and numbers that are used in more than one place as global constants. That way it's easy to change them, and you only need to change them in one place!

Copy link

@Npahlfer Npahlfer left a comment

Choose a reason for hiding this comment

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

Generally good, it would have been nice to see some of the stretch goals like the loading and local storage, but your code is easy to follow, but try to make use of shared constants :)

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.

3 participants