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

Reorder Patterns, Folders in Pattern Lab Nav Based On Order Config #149

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

Conversation

sghoweri
Copy link
Contributor

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 the order 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 cooresponding fonts.md file:

---
order: 4
---

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):

  1. 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.

  2. 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

Configuring the Organisms top level Pattern Type order to -1, Buttons and Images Pattern SubTypes to 2 and 10, and nested Animations and Fonts patterns to -1 and 4 respectfully. Huzzah!

pattern_lab_-_all

CC @bradfrost @aleksip @christophersmith262

…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
… patternTypes reordered + non-nested patterns working! Addresses #138
@bradfrost
Copy link
Member

Awesome work, @sghoweri!

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

Successfully merging this pull request may close these issues.

3 participants