Sorting algorithm
zmeecer opened this issue · 5 comments
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
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 ofBreadcrumbs
component - make sorted data
array of values
intead ofarray 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.
I checked just now, current sorting is already checked in tests. So, the first step is not needed.
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
Vesrion 1.1.1 is published. Thanks, people will appreciate this feature.