denoland / dotland

[Archived] deno.land website
https://deno.land
MIT License
957 stars 626 forks source link

feat(registry): add next page button for module search #2111

Closed meszarosdezso closed 2 years ago

meszarosdezso commented 2 years ago

This adds a "Next" button to the bottom of the search results in the registry, so users can navigate to the next page of results without updating the url manually.

Screenshot 2022-04-14 at 14 22 30

As far as I could figure it out from the registry's source code, searching is sorting all the modules based on a scoring function, and returns the first 20, meaning we don't have a "number of results" here and users can eventually get to a page with no related results.

Also, I've seen the api handler checks sorting by newest / oldest / stars by url parameter, but that doesn't seem like working currently (https://deno.land/x?sort=newest).

towards #2104

meszarosdezso commented 2 years ago

The diff looks like a mess in Github's UI, It's actually just a check if the query existst and conditionally render the whole pagination or the next button. Also added a helper function for the button's tw classes.