ash-jc-allen / find-a-pr

The source code for the findapr.io website
https://findapr.io
MIT License
74 stars 37 forks source link

Add ability to sort the PRs #2

Closed ash-jc-allen closed 2 years ago

ash-jc-allen commented 2 years ago

At the moment, the PRs are displayed in the order that they're returned from the GitHub API.

It would be nice to be able to sort them based on a few different fields:

bowett commented 2 years ago

Hi, this is my first attempt at open source contribution so apologies in advance for any stupid questions...

I have this working so you can pass the sort parameter in the url e.g.

/title - will sort the full list by title alphabetically. /createdAt - will sort in ascending created at order.

Does this sound ok or were you thinking of it working in a different way?

Also, how do you see the UI working? I thought a few buttons along the top which link to the correct route?

I see you are using tailwind, is there a specific component library you prefer to use?

ash-jc-allen commented 2 years ago

Hey @bowett! Don't worry, there's no such thing as a stupid question 😄

To be fair, I think that sounds more or less along the same lines as I was thinking. But, I think it'd be slightly better if we could maybe use query params instead?

I was thinking something along the lines of ?sort=title, etc. Would it be easy enough for you to change your existing code to use this approach?

And for the toggle, I'm pretty open to any ideas on that front. I was originally thinking of using the first dropdown on Tailwind UI (https://tailwindui.com/components/application-ui/elements/dropdowns). But I'm not fixed on that and I'm happy to take other suggestions 😄