@patternfly/documentation-framework 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 1.7.0 (2023-02-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **docs:** customize tabs with optional tabText frontmatter ([#3394](https://github.com/patternfly/patternfly-org/issues/3394)) ([093c6c7](https://github.com/patternfly/patternfly-org/commit/093c6c77053f544605d40f8918dc5621829ac7c3))
12
+
13
+
14
+
15
+
16
+
17
+ ## 1.6.1 (2023-02-09)
18
+
19
+ **Note:** Version bump only for package @patternfly/documentation-framework
20
+
21
+
22
+
23
+
24
+
6
25
  # 1.6.0 (2023-02-07)
7
26
 
8
27
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly/documentation-framework",
3
3
  "description": "A framework to build documentation for PatternFly.",
4
- "version": "1.6.0",
4
+ "version": "1.7.0",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -84,5 +84,5 @@
84
84
  "react": "^16.8.0 || ^17.0.0",
85
85
  "react-dom": "^16.8.0 || ^17.0.0"
86
86
  },
87
- "gitHead": "4ad5d447527c174b073efeaf3d5c720f9623ddc4"
87
+ "gitHead": "a9a48b143a7a72b044d35960fee0c8122a117b9c"
88
88
  }
@@ -85,6 +85,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
85
85
  section: frontmatter.section || '',
86
86
  subsection: frontmatter.subsection || '',
87
87
  source,
88
+ tabName: frontmatter.tabName || null,
88
89
  slug,
89
90
  sourceLink: frontmatter.sourceLink || `https://github.com/patternfly/${
90
91
  sourceRepo}/blob/main/${
@@ -266,6 +267,7 @@ function sourceMDFile(file, source, buildMode) {
266
267
  section: pageData.section,
267
268
  subsection: pageData.subsection,
268
269
  source: pageData.source,
270
+ tabName: pageData.tabName,
269
271
  ...(pageData.katacodaLayout && { katacodaLayout: pageData.katacodaLayout }),
270
272
  ...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
271
273
  };
package/templates/mdx.js CHANGED
@@ -121,7 +121,15 @@ export const MDXTemplate = ({
121
121
  id,
122
122
  componentsData
123
123
  }) => {
124
- const sourceKeys = sources.map(v => v.source);
124
+ // Build obj mapping source names to text displayed on tabs
125
+ const tabNames = sources.reduce((acc, curSrc) => {
126
+ const { source, tabName } = curSrc;
127
+ // use tabName for tab name if present, otherwise default to source
128
+ const tabLinkText = tabName || capitalize(source.replace('html', 'HTML').replace(/-/g, ' '));
129
+ acc[source] = tabLinkText;
130
+ return acc;
131
+ }, {});
132
+ const sourceKeys = Object.keys(tabNames);
125
133
  const isSinglePage = sourceKeys.length === 1;
126
134
 
127
135
  let isDevResources, isComponent, isExtension, isChart, isDemo, isLayout, isUtility;
@@ -223,7 +231,7 @@ export const MDXTemplate = ({
223
231
  onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
224
232
  >
225
233
  <Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
226
- {capitalize(source.replace('html', 'HTML').replace(/-/g, ' '))}
234
+ {tabNames[source]}
227
235
  </Link>
228
236
  </li>
229
237
  ))}
@@ -7,6 +7,8 @@ section: extensions
7
7
  id: My extension
8
8
  # Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
9
9
  source: design-guidelines
10
+ # Optional custom text to display in tab in place of source
11
+ tabName: My custom tab-name
10
12
  ---
11
13
 
12
14
  Design guidelines intro
@@ -7,6 +7,8 @@ section: extensions
7
7
  id: My extension
8
8
  # Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
9
9
  source: react
10
+ # Optional custom text to display in tab in place of source
11
+ tabName: My custom tab-name
10
12
  # If you use typescript, the name of the interface to display props for
11
13
  # These are found through the sourceProps function provdided in patternfly-docs.source.js
12
14
  # Can also pass object { component: string, source: string } allowing to specify the source