Skip to content

Conversation

@kmonahan
Copy link
Contributor

…pattern groupings

Closes #1049

Summary of changes:
Limits the separated pattern-folder support to patterns that are nested at least two levels deep. This seems to be how the PHP version works and supports both of the following use cases:
[patternType]/[patternSubType]/[pattern]/[pattern].hbs (which appears to be the original intent of #992 and [patternType]/[patternSubType]/[pattern].hbs, where the pattern and patternSubType are the same (as in the use case in #1049, where the patternSubType button might contain button.hbs and button--variant.hbs.

@kryp71c
Copy link

kryp71c commented Sep 17, 2019

It seems the pattern states are missing from the nav with this change.

@kmonahan
Copy link
Contributor Author

Hey @kryp71c,
I'm not quite sure what you mean. Can you give an example of a pattern that's missing? I can then take a look.

@coreylafferty
Copy link

coreylafferty commented Sep 17, 2019

@kmonahan I think they mean the state is missing. For example, if you create a file named dog.md next to your dog.mustache or dog.twig file, and add the following contents:

---
el: .dog
title: Dog
state: inreview
---

the 'inreview' yellow dot doesn't show next to the item in the menu. I suspect that's due to the removal of the 'info' variable being passed in.

@kmonahan
Copy link
Contributor Author

Ah, got it. Thanks! WIll investigate and update my branch.

@kmonahan
Copy link
Contributor Author

kmonahan commented Sep 18, 2019

Dug into this one and I think what actually needs to be fixed here is what's being done in PR #1058 .

I tested locally with a pattern called Dog with a state of 'inreview' and a pattern called Dog Special with a state of 'inprogress'. When I organized the patterns in the patternType/patternSubtype structure (so my templates and markdown files were in 00-animals/dog/), I see the state indicators in the nav:
animals-dog-dog

Likewise, when I organized the patterns in the patternType/patternSubtype/pattern structure (so the dog template and markdown files were in 00-animals/dogs/dog/), I also see the state indicators in the nav:
animals-dogs-dog

Where I don't see the indicators is when I use the patternType/patternSubtype structure with only one pattern in it: 00-animals/dog/ without the Dog Special pattern. Previously, this worked if the directory had the same name as the pattern but did not work if the names were different. When I rename my folder to "doggie", it's clearer that what's showing up in the nav is just the directory with no subnav listing the patterns underneath it, and hence no status indicator:
Screen Shot 2019-09-18 at 2 18 56 PM

Rather than have the status indicator appear in the nav next to the pattern subtype name if it matches the pattern, my desired behavior here would be for the pattern subtype to have a submenu listing the pattern(s) and their status indicators. When I merged #1058 in locally, that's exactly what I get:
with-1095

So rather than make further changes here, I think it makes more sense to leave this PR as-is and handle the directory flattening issue in 1058, unless there are other state display issues beyond that one.

@coreylafferty
Copy link

@sghoweri @bmuenzenmeyer now that #1058 is accepted, I believe this PR should be good to go.

@bmuenzenmeyer
Copy link
Member

i'll need some time to re-read through this

Copy link
Contributor

@sghoweri sghoweri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks so much for this @kmonahan!

I've tested this out locally with a few different combos of nested folders / patterns (including adding State to a few of them to double-check that 😉) and can verify that this all seems to be working as expected (and as an added bonus, now seems to match the overall expected behavior of Pattern Lab PHP as well). 🎉

Nice work!

# Conflicts:
#	packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js
@sghoweri sghoweri added bug 🐛 hacktoberfest 🌾 https://hacktoberfest.digitalocean.com enhancement ✨ labels Oct 19, 2019
@sghoweri sghoweri merged commit e73ac24 into pattern-lab:dev Oct 19, 2019
antonia-rose pushed a commit to quelltexterin/nemo-uikit-workshop that referenced this pull request Apr 12, 2023
…ry-naming

fix(1049): Treat folders like patterns only if they're subfolders of …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 enhancement ✨ hacktoberfest 🌾 https://hacktoberfest.digitalocean.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu & View All list breaks if pattern name and folder name are identical

5 participants