-
Notifications
You must be signed in to change notification settings - Fork 62
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
Implement better ordering #138
Comments
@EvanLovely I should be able to tackle this one tomorrow or Saturday. Off the top of my head I think we'll just need to sort the array of pattern objects in PL first (before anything gets compiled) based off of those specifying an order before handling the rest with the default order of zero. Should be a pretty easy win (and be a huge help with not having to rename files based on reordering OR based on their pattern state) |
Big +1 on this. I remember @davatron5000 discussing this way back in the day, so it would be great to roll that into our other conventions so file names can stay consistent and we can lose the |
Just want to confirm a couple things after thinking this through a bit more.
**if we were to support multiple ways of configuring a pattern, I'd suggest we either: B. if somehow multiple file configs existed (ex. a .yml config value and .md config value, then simply process all of those config types equally and the last one processed wins (.yml in this case)
Does this all kinda make sense @EvanLovely @bradfrost? |
Ok, @EvanLovely @bradfrost good news and bad news! Good news: I think I got this working in the main nav as a POC (even though it took me most of the day today to deconstruct and reconstruct what PL is doing under the hood ) 🍺 🍻 😪 Bad news: looks there might be a bug (existing bug?) relating to the navigation / nav data when markdown files are added for patternSubTypes that this work seems to have surfaced (ex. if I had a Need to get what I have locally in a stable spot before I can push anything up but in any case, making progress here! |
Thanks for rolling up your sleeves with this, @sghoweri! I'll avoid getting in the weeds (largely because I'm unsure of what's going on under the hood), but I think the spirit of the task is as follows:
Do I have that right? To address some of the things in here. @EvanLovely said:
As a user, if I gave something a value of
Is that what you had in mind, @EvanLovely? @sghoweri said:
With respect to multiple config files, I think that it should be a possibility to support .json or .yml config files, but having those multiple configs exist simultaneously should be discouraged (or disallowed?). In any case, for order it seems to make sense to have the last-defined Sorry I can't be of any help on the implementation stuff, but if you want to run some ideas by an idiot user, just ping me! |
Thanks @sghoweri - you rock! 🎉 I choose the default value of
So it should go:
Everything is finally settled alphabetically (which would also put Also, I brought this up in The Spec to formalize using |
@EvanLovely so wait, negative numbers wouldn't be allowed? Why wouldn't we do something like this? https://codepen.io/sghoweri/pen/YrggVp IMO we should only allow integers to keep things relatively simple (ya gotta pick -- either make something heavier to drop it's natural location down or lighten it up to raise it) |
Also, I'm gonna shoot for getting at least half my code for this posted this weekend (crazy work week) - thinking 1 PR for globally setting order values for all Pattern Object data that needs it + a separate one for the actual reordering itself. I found that trying to make changes to the order PL naturally wants to use is immensely easier in the Pattern Exports themselves than to try to do it before the Pattern rules get run through... |
…new `order` property (using the primary nav at the moment to validate everything is working as expected). Major part of the underlying work behind #138
Ugh. Still working through some strange behavior on this one (on the feature/reorder-patterns branch I just pushed up). Just focusing on getting the dropdown navigation / nested nav items sorted using this atm but even that is proving to being harder than expected. I've got this working partially (at least w/ the nav items that have |
… patternTypes reordered + non-nested patterns working! Addresses #138
I am using Pattern Lab Twig. Is there a functionality within it to order your patterns by config file? |
If there is a MD doc with this:
It should sort by that and then name. The default of order is
0
. This is already implemented in the node version and was implemented in this version here: #137 - so that makesorder
available in the Pattern Data and ready to implement.The text was updated successfully, but these errors were encountered: