|
2 | 2 | layout: docs
|
3 | 3 | title: Using Pattern States | Pattern Lab
|
4 | 4 | heading: Using Pattern States
|
| 5 | +languages: |
| 6 | +- language: php |
| 7 | +- language: node |
5 | 8 | ---
|
6 | 9 |
|
| 10 | +<!--- start php --> |
| 11 | + |
| 12 | +<div class="tab-panel" id="php"> |
| 13 | +<h2 class="language-title">php</h2> |
| 14 | + |
| 15 | +{% capture m %} |
| 16 | + |
7 | 17 | **Note:** *Pattern states were introduced in v0.7.5 of the PHP version of Pattern Lab.*
|
8 | 18 |
|
9 | 19 |
|
@@ -40,3 +50,56 @@ You can use the following as your CSS template for new pattern states:
|
40 | 50 | }
|
41 | 51 |
|
42 | 52 | Then add `@newpatternstate` to your patterns to have the new look show up. If you want to add it to the cascade of the default patterns you can modify your `config.ini`. Simply add your new pattern state to the `patternStates` list.
|
| 53 | + |
| 54 | +{% endcapture %} |
| 55 | +{{ m | markdownify }} |
| 56 | + |
| 57 | +</div> |
| 58 | + |
| 59 | +<!--- end php --> |
| 60 | + |
| 61 | +<!--- start node --> |
| 62 | + |
| 63 | +<div class="tab-panel" id="node"> |
| 64 | +<h2 class="language-title">node</h2> |
| 65 | + |
| 66 | +{% capture m %} |
| 67 | + |
| 68 | +**Note:** *Rudimentary support for pattern states was introduced in v0.1.3 of the Node version of Pattern Lab. Pattern states do not inherit the lowest state from any partials yet.* |
| 69 | + |
| 70 | +Pattern states provide your team and your client a simple visual of the current state of patterns in Pattern Lab. Pattern states can track progress of a pattern from development, through client review, to completion or they can be used to give certain patterns specific classes. |
| 71 | + |
| 72 | +## The Default Pattern States |
| 73 | + |
| 74 | +The Node version of Pattern Lab comes with the following default pattern states: |
| 75 | + |
| 76 | +* **inprogress**: pattern is in development or being worked upon. a red dot. |
| 77 | +* **inreview**: pattern is ready for a client to look at and comment upon. a yellow dot. |
| 78 | +* **complete**: pattern is ready to be moved to production. a green dot. |
| 79 | + |
| 80 | +## Giving Patterns a State |
| 81 | + |
| 82 | +In the Node version of Pattern Lab, pattern states are managed centrally from inside `config.json`. Adding the [pattern-type]-[pattern-name] name as the key, followed by the class name will apply the pattern state: |
| 83 | + |
| 84 | +``` |
| 85 | +"patternStates": { |
| 86 | + "homepage-emergency" : "inprogress" |
| 87 | +}, |
| 88 | +``` |
| 89 | + |
| 90 | +## Adding Customized States |
| 91 | + |
| 92 | +The three default states included with the Node version of Pattern Lab might not be enough for everyone. To add customized states you should modify your own CSS files. **DO NOT** modify pattern states in `public/styleguide/css/styleguide.css`. You cannot be assured these files won't be overwritten. |
| 93 | + |
| 94 | +You can use the following as your CSS template for new pattern states: |
| 95 | + |
| 96 | + .newpatternstate:before { |
| 97 | + color: #B10DC9 !important; |
| 98 | + } |
| 99 | + |
| 100 | +{% endcapture %} |
| 101 | +{{ m | markdownify }} |
| 102 | + |
| 103 | +</div> |
| 104 | + |
| 105 | +<!--- end node --> |
0 commit comments