Reorder Patterns, Folders in Pattern Lab Nav Based On Order
Config
#149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Specifically, allow Pattern Lab users to manually adjust the visual ordering of any navigation items in the Pattern Lab main menu based on the configurable
order
property that's set in a pattern's config file (ie. a corresponding pattern markdown file with theorder
key set.) -- without needing to make any physical filename / folder name changes or prefixes.Ex. given a fonts.twig file, the default
0
zero order value could get overwritten (pushed up or down the list) in the coorespondingfonts.md
file:This PR also updates all top level Pattern Types, Pattern SubTypes, Patterns, & Pattern Items top inherit a default order value set in case a manually-entered value isn't set.
In short, this PR tries to take a crack at attempting to address the bulk of the use cases and details mentioned in #138 without having to go too far off the deep end for this one. Oh - and this also manages to get top level Pattern Types to be configurable now via markdown files as well! =)
Author's sidenote(s):
This PR covers the across the board data updates needed to let us set an order property (with an inherited default), updates to the Documentation rule so top level Pattern Types can be sorted via markdown files, and the sorting of Pattern Types, Pattern SubTypes, Pattern Items, and Pattern SubTypeItems in the top level Pattern Lab dropdown navigation but this PR does NOT unfortunately cover reordering the styleguide / viewall ordering as well (just yet). Way too much work already had to go into this so I figure to get this up here first so we can iterate vs having this get help up too much.
I had originally tried (and failed) to reorder everything at the central pattern data $store however I inevitably ran into major issues with getting things to render correctly and consistently (if at all) so this implementation tackles reordering "downstream" when the final data structure is getting ready to be exported (ie. exported as the top level navigation). This might be something to take another look into down the road, or by someone who speaks PHP as a first language...
Example test w/ Order Output for Debugging
CC @bradfrost @aleksip @christophersmith262