iiitl / GitHub-Finder

0 stars 12 forks source link

Search bar fix #9

Open akshat-bhansali opened 6 months ago

akshat-bhansali commented 6 months ago

The navbar has a search bar present in it. You have to make a list of users(first 5) appear according to the search. Example :- If I type "AK" then the list should Akshit-Nandan and Akshat-Bhansali in it. List format is icon on left and name following it. On clicking on any user, it should be directed to their profile(Example - /profile/Akshit-Nandan ....check the route in the hackathon participant section for reference) The list of all users is present in the "listUser" useState variable in the navbar file

0PrashantYadav0 commented 6 months ago

@akshat-bhansali
i would like to work on this issue. Also i want to ask that do we need to add search button for searching or it will be based on input??

akshat-bhansali commented 6 months ago

@0PrashantYadav0 whenever the input text changes,show the top 5 results from the list stored in one of the usestate variables in navbar component. The variable is already being logged every time the input changes since it is in the dependency array of the use state.You just have to manipulate the data. Also,please explain me your approach

0PrashantYadav0 commented 6 months ago

@akshat-bhansali i will take input in search bar and match the input from user list present in navbar using startsWith() function

akshat-bhansali commented 6 months ago

It is not to be checked with just the starting…The text can be any part of it.Basically it is REGEX Let me know your approach so that I can assign you the issue

0PrashantYadav0 commented 6 months ago

Ohk then i will use includes() function to search for pattern and sort the array so that i will give the closest result

akshat-bhansali commented 6 months ago

@0PrashantYadav0 I have assigned you the issue.All the best!