-
Notifications
You must be signed in to change notification settings - Fork 2
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
7. add search list form and function in List #25
Conversation
Visit the preview URL for this PR (updated for commit eda4664): https://tcl-66-smart-shopping-list--pr25-ec-hm-issue-7-eu7cc3wm.web.app (expires Fri, 01 Mar 2024 16:18:37 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2dc16cb2a79cbd6723fdc511b73e0743df1d18d0 |
Everything seems to work correctly except when I searched for one specific item. I used the groceries list that we all have since it had the most items added to it. But when I try and search for banana, it doesn't pop up. I tried using a capital B since the original list item is "Banana", but that also didn't do anything. If I search 'an' it pops up though. I added some more items that start with a capital and it seems they also have that issue. |
Good call @eonflower. So there are two ways this can be fixed, the first is just to do this *note: if we change the items going into the database we will also have to edit any existing items to be consistent with being in all lower case but it's a relatively easy change. |
Personally, I like consistency within the database and then we can style the items to have the first letter capitalized later if we want that. |
@hun-ah , I agree with the consensus. Mange the format of the data before it enters the database. I did notice in the database that the item may actually be stored by a random number... there is a name key that stores the input value... but if I am seeing it correctly the items may be assigned a random number just wanted to bring that up :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Super clean code-- I noticed when I did a search with just a space, it worked to filter any items that had a space in them, and I liked that.
@eonflower @StefieCaff @hun-ah Per our consensus, the "toLowerCase" method has been added to firebase.js to apply a lowercase format to the grocery item names that a user creates. I edited all preexisting grocery names in our firestore database which contained capital letters to be in lowercase format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job y'all!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, looks good to me!
@@ -1,13 +1,43 @@ | |||
import { ListItem } from '../components/ListItem'; | |||
import { useState } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extremely pedantic but it's common practice to put library imports at the very top above files/components that are in the project.
src/views/List.jsx
Outdated
onChange={handleChange} | ||
value={search} | ||
/> | ||
<button onClick={handleClear}>x</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also pedantic but this should have type="button"
on it, even with the e.preventDefault
since this button will technically try to submit the form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, @jeremiahfallin! We implemented both of your recommendations.
For an example of how to fill this template out, see this Pull Request.
Description
Related Issue
closes #7
Acceptance Criteria
List
view, above the shopping list<label>
!) which narrows down the list as the user typesType of Changes
Enchancement
Updates
Before
After
Screen.Recording.2024-02-21.at.1.59.42.PM.mov
Testing Steps / QA Criteria