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

Feature/search component #132

Merged
merged 10 commits into from
Sep 30, 2021
Merged

Feature/search component #132

merged 10 commits into from
Sep 30, 2021

Conversation

galbwe
Copy link
Collaborator

@galbwe galbwe commented Sep 29, 2021

Addresses #109

Changes

  • Added a search string to Home component state and included it in the query parameters in the fetch call to /leads.
  • Added a Search component that takes a time limit in milliseconds and an event handler as props. After the time limit expires the event handler is passed an onchange event from a text input.
  • Refactored the Header component to accept child props and pass the Search component as a child in Home.js. This was to allow passing setSearch as a prop to the Search component without prop drilling through the Header component.

Notes

@galbwe galbwe linked an issue Sep 29, 2021 that may be closed by this pull request
Copy link
Collaborator

@clairefields15 clairefields15 left a comment

Choose a reason for hiding this comment

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

Looks great! I'm not super familiar with debounce so I can't give the most thorough review. One thing you might want to add/consider is some kind of validation of the search value like making it all lowercase, removing special characters, escaping spaces, that kind of thing, but it looks like there is another issue for those things!

}));

export default function Header() {
export default function Header({ children }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice refactor, I've never seen this done before but it's great not to have to prop drill!

@clairefields15 clairefields15 merged commit aa48a9f into main Sep 30, 2021
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.

Search component
2 participants