-
Notifications
You must be signed in to change notification settings - Fork 9
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
Live Search #26
Comments
I did So: - The idea: - steps:
- To improve:
Dear team's members, this was my idea. Please try the App , the config file has already my setting. so you can run it directly on my data base. Thanks. |
Added active class on clicking according to the current page! |
Until now:
|
User Story:
As a user, I want to be able to search for other users directly from the developers page. When typing in the search field, I want to see a list of users whose names match with the letters that I type in the field. And when I click on a developer view profile button, it has to take me to the user's profile. And when the developers page gets bigger, I want to have separate pages: each page displaying 5 developers profiles, or the number could be increased in the future.
Implementing customer needs:
-Front-end:
HTML:
⦁ Search field: input elements of type search.
⦁ Pagination: ul unordered list of items.
CSS:
⦁Styling input element using CSS attribute and class selectors.
⦁Taking into the consideration the concept of mobile-first approach.
JavaScript:
⦁ Search field:
a. Array filter method: To create a new array with all elements that pass the test implemented by the provided function.
b. toLowerCase method: JavaScript is a case sensitive programing language, an inequality between two letters can occurre in case one of them is lower case, or upper case.
c. includes method: Is a case sensitive, determines whether a userName contains the given characters (searchText) within it or not, returns true or false.
⦁Pagination:
a. Passing the total number of profiles (totalProfiles) to a Pagination component, as well as page size (profilesPerPage), to calculate the number of pages and reder them.
b. Passing (handlePageChange) method: to rise an event (onPageChange) whenever a user clicks on a new page, the method receives a new page number.
c. To map each page number to a list item, we created pageNumbers array based on dividing the totalProfiles by profilesPerPage. Assuming that we have 10 profiles and we want to display 5 profiles for each page, we will get 2 page numbers.
d. Using Math.ceil method to avoid having floating point number as a result of division we used.
e.handlePageChange sets the current page number.
f. To display developers on each page using slice currentProfiles depending on indexOfLastProfile and indexOfFirstProfile.
Back-end:
-Getting Profiles from /api/profile route, uising axios.get('/api/profile') method.
The text was updated successfully, but these errors were encountered: