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

As a user, I want to see the items in the selected list displayed with a checkbox, item name, urgency category (in different colors), and a delete button #42

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

didemydn
Copy link
Collaborator

@didemydn didemydn commented Sep 26, 2024

Description

all the items to appear in a single line but the text for the urgency category (e.g., "soon") should be colored based on urgency.

Related Issue

closes #43

Acceptance Criteria

  • The ListItem component displays category colors, assigning specific colors (purple, orange, green, red, gray) to urgency categories such as "soon," "kind of soon," etc.
  • The layout is adjusted using CSS for `ListItem' component so that the checkbox, item name, urgency category, and delete button are aligned in a single row.

Updates

Before

image

After

image

@didemydn didemydn self-assigned this Sep 26, 2024
Copy link

github-actions bot commented Sep 26, 2024

Visit the preview URL for this PR (updated for commit 153c1d1):

https://tcl-78-smart-shopping-list--pr42-dc-urgency-categorie-ull8oxz4.web.app

(expires Fri, 04 Oct 2024 21:58:45 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c781903507c1507075d7a974036959ddeec29c0a

@didemydn didemydn requested a review from eva-lng September 26, 2024 21:20
Copy link
Collaborator

@eva-lng eva-lng left a comment

Choose a reason for hiding this comment

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

The feature works as expected, well done!

@eva-lng eva-lng requested review from Amaka202 and vivitt September 27, 2024 14:08
Copy link
Collaborator

@vivitt vivitt 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 on this PR! The information in the list is noticeably better organized. Thanks ⚡️

@@ -26,6 +32,23 @@ export function ListItem({ name, dateLastPurchased, onCheck, onDelete }) {
}
};

const categoryColor = (category) => {
Copy link
Collaborator

@vivitt vivitt Sep 27, 2024

Choose a reason for hiding this comment

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

This switch statement works fine. Another option would be to use an object instead:

const categoryColor = { soon: 'purple', 'kind of soon': 'orange', 'not soon': 'green', overdue: 'red', inactive: 'gray', };

And then just use the key/value pair:
categoryColor[category]

Aside from that, I noticed that the combination of the text color for the 'soon' category and its background isn’t passing the contrast ratio check.
You can check it yourself here: https://webaim.org/resources/contrastchecker/.
You may want to consider using a darker text color or lightening the background, so the chosen colors reinforce accessibility in the app

@eva-lng eva-lng removed the request for review from Amaka202 September 27, 2024 16:09
@didemydn didemydn merged commit 65b1a5d into main Sep 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants