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

Sorting algorithm #19

Closed
zmeecer opened this issue Mar 26, 2018 · 5 comments
Closed

Sorting algorithm #19

zmeecer opened this issue Mar 26, 2018 · 5 comments

Comments

@zmeecer
Copy link
Contributor

zmeecer commented Mar 26, 2018

Hi!
As I understand all breadcrumbs items are sorted by pathname by the following function:
https://github.com/oklas/react-breadcrumbs-dynamic/blob/master/src/index.js#L47

So it's not so easy to control order of breadcrumbs item in the Container component. In my case it is necessary for adding routes with absolute links. Something like weight parameter

I will be glad to make a new PR after your agreement

@oklas
Copy link
Owner

oklas commented Mar 26, 2018

Hi!
It need to do in like this:

  • write commit with a tests which check the sorting as currently is
  • add user-defined function in compare property of Breadcrumbs component
  • make sorted data array of values intead of array of keys for user func at mentioned line
  • sorting must be performed by user defined function or by default function if not specified
  • write a tests with user defined function

So if users need to sort by any other criteria included analize some additional
breadcrumbs item property will be possible to do id as desired.

It will be excellent if you have time to do that or let me know if you busy then i will do that nearest days.

@oklas
Copy link
Owner

oklas commented Mar 26, 2018

I checked just now, current sorting is already checked in tests. So, the first step is not needed.

@zmeecer
Copy link
Contributor Author

zmeecer commented Mar 26, 2018

Thanks for the quick and detailed response!

I have some time, so I will try to implement in time

It will be fair because I use your library

@zmeecer
Copy link
Contributor Author

zmeecer commented Mar 27, 2018

review, please
#20

@oklas
Copy link
Owner

oklas commented Mar 28, 2018

Vesrion 1.1.1 is published. Thanks, people will appreciate this feature.

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

No branches or pull requests

2 participants