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

feat: add sorting logic for resources #709

Merged
merged 13 commits into from
Jul 5, 2024

Conversation

chosww
Copy link
Contributor

@chosww chosww commented Sep 7, 2023

  • This pull request has been tested by running npm run test without errors
  • This pull request has been built by running npm run build without errors
  • This isn't a duplicate of an existing pull request

Description

Resolves #518:
Add sort and pin features to the resources page.

Steps to test

  1. Go to resources page
  2. Change the options for sort by control and see if the resources are sorted correctly

Additional information

Currently we only have title and publishedYear attributes to sort the resources by, it would probably makes sense to add more attributes for sorting category.

Related issues

Resolves #518

@chosww chosww self-assigned this Sep 7, 2023
@chosww chosww added the enhancement New feature or request label Sep 7, 2023
@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for idrc ready!

Name Link
🔨 Latest commit 383fec6
🔍 Latest deploy log https://app.netlify.com/sites/idrc/deploys/6687f94380e7c20008dc8949
😎 Deploy Preview https://deploy-preview-709--idrc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@chosww
Copy link
Contributor Author

chosww commented Sep 7, 2023

@jhung, do you have some time on this project to add some design for the sort UI?

@chosww chosww marked this pull request as ready for review September 25, 2023 19:20
@jhung
Copy link
Member

jhung commented Sep 26, 2023

@chosww here's a mockup of the filter. The behaviour is the same as what is there currently with the following adjustments:

  1. Added padding on the select box text
  2. Removed reverse alphabetical sort (unlikely to be useful).
  3. Reworded options to "Oldest published" and "Newest published"

image

@jhung
Copy link
Member

jhung commented Oct 5, 2023

@chosww I took a look at the preview - it looks fine to me. However, can you put "Newest Published" before "Oldest Published"?

@chosww
Copy link
Contributor Author

chosww commented Oct 5, 2023

@chosww I took a look at the preview - it looks fine to me. However, can you put "Newest Published" before "Oldest Published"?

That's great! I updated the order as you requested. @greatislander I think this work is ready for your review now.

@@ -465,6 +465,8 @@ collections:
create: true
i18n: false
fields:
- {label: Layout, name: layout, widget: hidden, default: layouts/single--resource.njk}
Copy link
Member

Choose a reason for hiding this comment

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

Why is this required?

export function renderSortUI() {
let sortUIHtml =
`<div class='resources-sort'>
<p>
Copy link
Member

Choose a reason for hiding this comment

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

This should be a <label>— the select has no accessible name.

@greatislander
Copy link
Member

Additionally to the two issues I identified above, there's a broader problem with the filtering/sorting which is that the change on input is not communicated to screen readers. We should discuss this, @chosww.

@greatislander greatislander merged commit 1e89fc5 into inclusive-design:dev Jul 5, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add additional sorting and filtering options to Resources
3 participants