@patternfly/documentation-framework 1.2.69 → 1.2.70
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 +8 -0
- package/package.json +2 -2
- package/templates/mdx.js +56 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.2.70 (2022-12-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## 1.2.69 (2022-12-05)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
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.2.
|
|
4
|
+
"version": "1.2.70",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"react": "^16.8.0 || ^17.0.0",
|
|
86
86
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "0f120199eeeb5b9fb70c857bcccf1e7c435ae7e9"
|
|
89
89
|
}
|
package/templates/mdx.js
CHANGED
|
@@ -123,7 +123,41 @@ export const MDXTemplate = ({
|
|
|
123
123
|
}) => {
|
|
124
124
|
const sourceKeys = sources.map(v => v.source);
|
|
125
125
|
const isSinglePage = sourceKeys.length === 1;
|
|
126
|
-
|
|
126
|
+
|
|
127
|
+
let isDevResources, isComponent, isExtension, isChart, isDemo, isLayout, isUtility;
|
|
128
|
+
|
|
129
|
+
const getSection = () => {
|
|
130
|
+
return sources.some((source) => {
|
|
131
|
+
switch (source.section) {
|
|
132
|
+
case "developer-resources":
|
|
133
|
+
isDevResources = true;
|
|
134
|
+
return;
|
|
135
|
+
case "components":
|
|
136
|
+
isComponent = true;
|
|
137
|
+
return;
|
|
138
|
+
case "extensions":
|
|
139
|
+
isExtension = true;
|
|
140
|
+
return;
|
|
141
|
+
case "charts":
|
|
142
|
+
isChart = true;
|
|
143
|
+
return;
|
|
144
|
+
case "demos":
|
|
145
|
+
isDemo = true;
|
|
146
|
+
return;
|
|
147
|
+
case "layouts":
|
|
148
|
+
isLayout = true;
|
|
149
|
+
return;
|
|
150
|
+
case "utilities":
|
|
151
|
+
isUtility = true;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// hide tab if it doesn't include the strings below
|
|
158
|
+
const hideTabName = sourceKeys.some(
|
|
159
|
+
(e) => e.includes("pages") || e.includes("training")
|
|
160
|
+
);
|
|
127
161
|
const { pathname } = useLocation();
|
|
128
162
|
const { katacodaLayout } = sources[0].Component.getPageData();
|
|
129
163
|
let activeSource = pathname.replace(/\/$/, '').split('/').pop();
|
|
@@ -145,11 +179,24 @@ export const MDXTemplate = ({
|
|
|
145
179
|
document.title = getTitle(title);
|
|
146
180
|
}
|
|
147
181
|
|
|
182
|
+
const getClassName = () => {
|
|
183
|
+
getSection();
|
|
184
|
+
if (isChart || isDevResources || isExtension) {
|
|
185
|
+
if (isSinglePage) {
|
|
186
|
+
return "pf-m-light-100";
|
|
187
|
+
}
|
|
188
|
+
return "pf-m-light";
|
|
189
|
+
} else if (isUtility || isDemo || isLayout || isComponent) {
|
|
190
|
+
return "pf-m-light";
|
|
191
|
+
}
|
|
192
|
+
return "pf-m-light-100";
|
|
193
|
+
};
|
|
194
|
+
|
|
148
195
|
return (
|
|
149
196
|
<React.Fragment>
|
|
150
197
|
<PageGroup>
|
|
151
198
|
<PageSection
|
|
152
|
-
className={
|
|
199
|
+
className={getClassName()}
|
|
153
200
|
variant={!isSinglePage ? PageSectionVariants.light : ""}
|
|
154
201
|
isWidthLimited
|
|
155
202
|
>
|
|
@@ -158,7 +205,10 @@ export const MDXTemplate = ({
|
|
|
158
205
|
{isComponent && summary && (<SummaryComponent />)}
|
|
159
206
|
</TextContent>
|
|
160
207
|
</PageSection>
|
|
161
|
-
{(!isSinglePage
|
|
208
|
+
{((!isSinglePage && !hideTabName) ||
|
|
209
|
+
isComponent ||
|
|
210
|
+
isUtility ||
|
|
211
|
+
isDemo) && (
|
|
162
212
|
<PageSection id="ws-sticky-nav-tabs" stickyOnBreakpoint={{'default':'top'}} type="tabs">
|
|
163
213
|
<div className="pf-c-tabs pf-m-page-insets pf-m-no-border-bottom">
|
|
164
214
|
<ul className="pf-c-tabs__list">
|
|
@@ -179,12 +229,10 @@ export const MDXTemplate = ({
|
|
|
179
229
|
))}
|
|
180
230
|
</ul>
|
|
181
231
|
</div>
|
|
182
|
-
|
|
232
|
+
</PageSection>
|
|
183
233
|
)}
|
|
184
234
|
<PageSection id="main-content" isFilled className="pf-m-light-100">
|
|
185
|
-
{isSinglePage &&
|
|
186
|
-
<MDXChildTemplate {...sources[0]} />
|
|
187
|
-
)}
|
|
235
|
+
{isSinglePage && <MDXChildTemplate {...sources[0]} />}
|
|
188
236
|
{!isSinglePage && (
|
|
189
237
|
<Router className="pf-u-h-100" primary={false}>
|
|
190
238
|
{sources
|
|
@@ -192,8 +240,7 @@ export const MDXTemplate = ({
|
|
|
192
240
|
source.index = index;
|
|
193
241
|
return source;
|
|
194
242
|
})
|
|
195
|
-
.map(MDXChildTemplate)
|
|
196
|
-
}
|
|
243
|
+
.map(MDXChildTemplate)}
|
|
197
244
|
</Router>
|
|
198
245
|
)}
|
|
199
246
|
</PageSection>
|