You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-5Lines changed: 42 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,13 +144,50 @@ The current selection is as follows.
144
144
}
145
145
```
146
146
##### Pattern States
147
-
You can set the state of a pattern by including it in `patternlab-config.json` too. The out of the box styles are in progress (orange), in review (yellow), and complete (green).
148
-
Pattern states should be lowercase and use hyphens where spaces are present.
147
+
You can set the state of a pattern by including its key in the `patternStates` object in `patternlab-config.json`, along with a style defined inside `patternStateCascade`. The out of the box styles are in progress (orange), in review (yellow), and complete (green).
149
148
```
150
149
"patternStates": {
151
-
"colors" : "inprogress",
152
-
"fonts" : "inreview",
153
-
"three-up" : "complete"
150
+
"atoms-colors" : "complete",
151
+
"molecules-primary-nav" : "inreview",
152
+
"organisms-header" : "inprogress"
153
+
}
154
+
```
155
+
156
+
Note that patterns inherit the lowest common denominator pattern state of their lineage.
157
+
Consider:
158
+
```
159
+
"patternStates": {
160
+
"molecules-single-comment" : "complete",
161
+
"organisms-sticky-comment" : "inreview",
162
+
"templates-article" : "complete"
163
+
}
164
+
```
165
+
In this case, two things are of note:
166
+
167
+
* templates-article will display inreview since it inherits `organisms-sticky-comment`
168
+
* pages-article will not display any pattern state, as it does not define one
169
+
170
+
The `patternStateCascade` array is important in that the order is hierarchical.
console.log('Found a lower common denominator pattern state: '+pattern.patternState+' on '+pattern.key+'. Setting reverse lineage pattern '+lineageRPattern.key+' from '+lineageRPattern.patternState);
0 commit comments