Skip to content

Commit 9fac269

Browse files
authored
feat(documentation): added (sub)groups documentation again #1262 (#1334)
* feat(documentation): added (sub)groups documentation again #1262 * docs(patterndocumentation): added docs for how to do the pattern subgroups documentation * chore(docs): added another small part * chore(demo): added a subgroups demo file * chore(docs): updated as requested
1 parent 236cd13 commit 9fac269

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

packages/core/src/lib/ui_builder.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ const ui_builder = function () {
140140
patternName: _.startCase(
141141
isSubgroupPattern ? pattern.patternSubgroup : pattern.patternGroup
142142
),
143-
patternDesc: '',
143+
patternDesc: isSubgroupPattern
144+
? pattern.patternSubgroupData.markdown
145+
: pattern.patternGroupData.markdown,
144146
patternPartial: `viewall-${pattern.patternGroup}-${
145147
isSubgroupPattern ? pattern.patternSubgroup : 'all'
146148
}`,

packages/docs/src/docs/pattern-documenting.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sitemapPriority: '0.8'
1111
sitemapChangefreq: 'monthly'
1212
---
1313

14-
Pattern documentation gives developers and designers the ability to provide context for their patterns. The documentation file consists of Markdown with YAML front matter. It should follow this format:
14+
Pattern documentation gives developers and designers the ability to provide context for their patterns and subgroups. The documentation file consists of Markdown with YAML front matter. It should follow this format:
1515

1616
```
1717
---
@@ -55,6 +55,19 @@ We'd name our documentation file:
5555
atoms/button/button~red.md
5656
```
5757

58+
## Documenting Subgroups
59+
60+
61+
To document pattern subgroups, you need to create a companion `.md` file for that subgroup. For example create `_patters/atoms/buttons/_buttons.md` for a pattern subgroup. In the `.md` file, the above concept can be applied. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/{pattern-sub-group folder name}/_{pattern-sub-group raw name without prefixes}.md`
62+
63+
64+
```markdown
65+
66+
This is a *Markdown* description of the subgroup button.
67+
```
68+
69+
In the future we'll even also provide the possibility to document groups as well.
70+
5871
## Adding More Attributes to the Front Matter
5972

6073
A future update of Pattern Lab will support more front matter attributes including: excludeFromStyleguide and links.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
order: 0
3+
---
4+
5+
A graphical element that indicates interactivity.

0 commit comments

Comments
 (0)