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 sortable name to file tree #807

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

colinricardo
Copy link

Checklist

  • Fix linting errors
  • Tests have been added / updated (or snapshots)

Change information

Currently the file tree component sorts based on the file/folder name.

However, this means that a file with name The file will come before than a file, since "T" < "a".

This PR adds an optional sortableName field, which allows us to pass in a lowercase name without modifying how the name is ultimately rendered.

An alternative approach would be to just do .toLowerCase() within the sorting functions, but this would change existing behavior, and some people may want default sorting to sort uppercase before lowercase.

Another approach would be for the file tree to be unopinionated about sort order (e.g. pass in a shouldSort?:boolean flag or similar.

First contribution, open to critiques!

@netlify
Copy link

netlify bot commented Nov 21, 2022

Deploy Preview for geist-ui ready!

Name Link
🔨 Latest commit c60f881
🔍 Latest deploy log https://app.netlify.com/sites/geist-ui/deploys/637b8f4ace1a5100071303e9
😎 Deploy Preview https://deploy-preview-807--geist-ui.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 settings.

@colinricardo
Copy link
Author

@unix informally tagging for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant