@patternfly/documentation-framework 2.0.0-alpha.29 → 2.0.0-alpha.30
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 +11 -0
- package/components/sectionGallery/sectionDataListLayout.js +67 -0
- package/components/sectionGallery/sectionGallery.css +44 -0
- package/components/sectionGallery/sectionGallery.js +53 -0
- package/components/sectionGallery/sectionGalleryLayout.js +37 -0
- package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
- package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
- package/package.json +2 -2
- package/scripts/md/parseMD.js +1 -0
- package/scripts/webpack/webpack.base.config.js +1 -1
- package/templates/mdx.js +37 -30
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# 2.0.0-alpha.30 (2023-04-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* white space change to test CI ([e9e7ed3](https://github.com/patternfly/patternfly-org/commit/e9e7ed3cf6007fcf022dd7693bfed12bdf9d7e9a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 2.0.0-alpha.29 (2023-04-26)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCell, Split, SplitItem, TextContent, Text, TextVariants, Label } from "@patternfly/react-core";
|
|
3
|
+
import { Link } from '../link/link';
|
|
4
|
+
import { convertToReactComponent } from "@patternfly/ast-helpers";
|
|
5
|
+
|
|
6
|
+
// convert summary text in drawer from string to jsx
|
|
7
|
+
const SummaryComponent = ({ id, itemsData }) => {
|
|
8
|
+
const itemDasherized = id.split(' ').join('-').toLowerCase();
|
|
9
|
+
const summary = itemsData?.[itemDasherized]?.summary;
|
|
10
|
+
if (!summary) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
// Remove anchor tags to avoid <a> in summary nested within <a> of Link card/datalistitem
|
|
14
|
+
const summaryNoLinks = summary.replace(/<Link[^>]*>([^<]+)<\/Link>/gm, '$1');
|
|
15
|
+
const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`);
|
|
16
|
+
const getSummaryComponent = new Function('React', code);
|
|
17
|
+
return getSummaryComponent(React);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const SectionDataListLayout = ({ galleryItems, layoutView }) => {
|
|
21
|
+
if (layoutView !== 'list') {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<DataList onSelectDataListItem={() => {}}>
|
|
27
|
+
{galleryItems.map(({ idx, slug, illustration, itemName, title, isBeta, id, galleryItemsData }) => (
|
|
28
|
+
<Link to={slug} key={idx} className="ws-section-gallery-item">
|
|
29
|
+
<DataListItem>
|
|
30
|
+
<DataListItemRow>
|
|
31
|
+
<DataListItemCells dataListCells={[
|
|
32
|
+
<DataListCell width={1} key="illustration">
|
|
33
|
+
{illustration && (
|
|
34
|
+
<div>
|
|
35
|
+
<img src={illustration} alt={`${itemName} illustration`} />
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
38
|
+
</DataListCell>,
|
|
39
|
+
<DataListCell width={5} key="text-description">
|
|
40
|
+
<Split className="pf-u-mb-md">
|
|
41
|
+
<SplitItem isFilled>
|
|
42
|
+
<TextContent>
|
|
43
|
+
<Text component={TextVariants.h2}>
|
|
44
|
+
<span>
|
|
45
|
+
{title}
|
|
46
|
+
</span>
|
|
47
|
+
</Text>
|
|
48
|
+
</TextContent>
|
|
49
|
+
</SplitItem>
|
|
50
|
+
<SplitItem>
|
|
51
|
+
{isBeta && <Label color="gold">Beta feature</Label>}
|
|
52
|
+
</SplitItem>
|
|
53
|
+
</Split>
|
|
54
|
+
<TextContent>
|
|
55
|
+
<Text>
|
|
56
|
+
{ id ? <SummaryComponent id={id} itemsData={galleryItemsData} /> : null }
|
|
57
|
+
</Text>
|
|
58
|
+
</TextContent>
|
|
59
|
+
</DataListCell>
|
|
60
|
+
]} />
|
|
61
|
+
</DataListItemRow>
|
|
62
|
+
</DataListItem>
|
|
63
|
+
</Link>
|
|
64
|
+
))}
|
|
65
|
+
</DataList>
|
|
66
|
+
)
|
|
67
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
..ws-mdx-content-content {
|
|
2
|
+
max-width: initial !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ws-section-gallery {
|
|
6
|
+
/* top placement */
|
|
7
|
+
margin-top: calc(var(--pf-c-page__main-section--PaddingTop) * -1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Toolbar styles */
|
|
11
|
+
.ws-section-gallery .pf-c-toolbar {
|
|
12
|
+
margin-left: calc(var(--pf-c-page__main-section--PaddingLeft) * -1);
|
|
13
|
+
border-bottom: var(--pf-c-page__sidebar--m-light--BorderRightWidth) solid var(--pf-c-page__sidebar--m-light--BorderRightColor);
|
|
14
|
+
margin-bottom: var(--pf-global--spacer--md);
|
|
15
|
+
width: calc(100% + var(--pf-c-page__main-section--PaddingLeft) + var(--pf-c-page__main-section--PaddingRight));
|
|
16
|
+
/* avoid hoverable data list items overlapping toolbar */
|
|
17
|
+
z-index: calc(var(--pf-global--ZIndex--xs) + 2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Match toolbar left-padding to gallery left-padding */
|
|
21
|
+
.ws-section-gallery .pf-c-toolbar .pf-c-toolbar__content {
|
|
22
|
+
--pf-c-toolbar__content--PaddingLeft: var(--pf-c-page__main-section--PaddingLeft);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Avoid toolbar wrap on smaller screens */
|
|
26
|
+
.ws-section-gallery .pf-c-toolbar__content-section {
|
|
27
|
+
flex-wrap: nowrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Avoid link styling on gallery/data list item names */
|
|
31
|
+
.ws-section-gallery-item {
|
|
32
|
+
text-decoration: inherit;
|
|
33
|
+
color: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Ensure same height for all cards in a gallery row */
|
|
37
|
+
.ws-section-gallery .pf-c-card {
|
|
38
|
+
height: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Limit width for data list view only */
|
|
42
|
+
.ws-section-gallery .pf-c-data-list {
|
|
43
|
+
max-width: 956px;
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import './sectionGallery.css';
|
|
4
|
+
import { SectionGalleryToolbar } from "./sectionGalleryToolbar";
|
|
5
|
+
import { SectionGalleryLayout } from "./sectionGalleryLayout";
|
|
6
|
+
import { SectionDataListLayout } from "./sectionDataListLayout";
|
|
7
|
+
import { SectionGalleryWrapper } from "./sectionGalleryWrapper";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper component returns gallery of items with search toolbar and switchable gallery/data list views.
|
|
11
|
+
* @param {Object} illustrations - Object of preview images mapped to their snake_case item display name
|
|
12
|
+
* @param {string} section - Name of the navigation section to create the gallery within
|
|
13
|
+
* @param {Object} galleryItemsData - Object containing the image location & summary text mapped to the gallery item's hyphenated-name
|
|
14
|
+
* @param {string} [placeholderText=Search by name] - Optional text to be displayed as placeholder for SearchInput
|
|
15
|
+
* @param {string} [countText= items] - Optional text to be displayed after the number of search results
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const SectionGallery = ({
|
|
19
|
+
illustrations,
|
|
20
|
+
section,
|
|
21
|
+
subsection = null,
|
|
22
|
+
includeSubsections = false,
|
|
23
|
+
parseSubsections = false,
|
|
24
|
+
galleryItemsData,
|
|
25
|
+
placeholderText,
|
|
26
|
+
countText
|
|
27
|
+
}) => (
|
|
28
|
+
<SectionGalleryWrapper
|
|
29
|
+
illustrations={illustrations}
|
|
30
|
+
section={section}
|
|
31
|
+
subsection={subsection}
|
|
32
|
+
includeSubsections={includeSubsections}
|
|
33
|
+
parseSubsections={parseSubsections}
|
|
34
|
+
galleryItemsData={galleryItemsData}
|
|
35
|
+
>
|
|
36
|
+
{(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) => {
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<SectionGalleryToolbar
|
|
40
|
+
galleryItems={sectionGalleryItems}
|
|
41
|
+
searchTerm={searchTerm}
|
|
42
|
+
setSearchTerm={setSearchTerm}
|
|
43
|
+
layoutView={layoutView}
|
|
44
|
+
setLayoutView={setLayoutView}
|
|
45
|
+
placeholderText={placeholderText}
|
|
46
|
+
countText={countText}
|
|
47
|
+
/>
|
|
48
|
+
<SectionGalleryLayout galleryItems={sectionGalleryItems} layoutView={layoutView} />
|
|
49
|
+
<SectionDataListLayout galleryItems={sectionGalleryItems} layoutView={layoutView} />
|
|
50
|
+
</>
|
|
51
|
+
)}}
|
|
52
|
+
</SectionGalleryWrapper>
|
|
53
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Gallery, GalleryItem, Card, CardTitle, CardBody, CardFooter, Label } from "@patternfly/react-core";
|
|
3
|
+
import { Link } from '../link/link';
|
|
4
|
+
|
|
5
|
+
export const SectionGalleryLayout = ({ galleryItems, layoutView }) => {
|
|
6
|
+
if (layoutView !== 'grid') {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Gallery hasGutter>
|
|
12
|
+
{galleryItems.map(({idx, slug, id, itemName, illustration, isBeta}) => (
|
|
13
|
+
<GalleryItem span={4} key={idx}>
|
|
14
|
+
<Link to={slug} className="ws-section-gallery-item">
|
|
15
|
+
<Card
|
|
16
|
+
id={id}
|
|
17
|
+
key={idx}
|
|
18
|
+
isSelectableRaised
|
|
19
|
+
>
|
|
20
|
+
<CardTitle>{itemName}</CardTitle>
|
|
21
|
+
{illustration && (
|
|
22
|
+
<CardBody>
|
|
23
|
+
<img src={illustration} alt={`${itemName} illustration`} />
|
|
24
|
+
</CardBody>
|
|
25
|
+
)}
|
|
26
|
+
{isBeta && (
|
|
27
|
+
<CardFooter>
|
|
28
|
+
<Label color="blue">Beta feature</Label>
|
|
29
|
+
</CardFooter>
|
|
30
|
+
)}
|
|
31
|
+
</Card>
|
|
32
|
+
</Link>
|
|
33
|
+
</GalleryItem>
|
|
34
|
+
))}
|
|
35
|
+
</Gallery>
|
|
36
|
+
)
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, SearchInput, Toolbar, ToolbarContent, ToolbarGroup, ToolbarItem, Text, TextVariants, ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
|
|
3
|
+
import ListIcon from '@patternfly/react-icons/dist/esm/icons/list-icon';
|
|
4
|
+
import ThIcon from'@patternfly/react-icons/dist/esm/icons/th-icon';
|
|
5
|
+
|
|
6
|
+
export const SectionGalleryToolbar = ({ galleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView, placeholderText ="Search by name", countText=" items" }) => (
|
|
7
|
+
<Toolbar isSticky>
|
|
8
|
+
<ToolbarContent>
|
|
9
|
+
<ToolbarItem variant="search-filter" widths={{default: '100%', md: '320px'}}>
|
|
10
|
+
<SearchInput onClear={false} value={searchTerm} placeholder={placeholderText} onChange={(_evt, val) => setSearchTerm(val)} />
|
|
11
|
+
</ToolbarItem>
|
|
12
|
+
{searchTerm && (
|
|
13
|
+
<ToolbarItem>
|
|
14
|
+
<Button variant="link" onClick={() => setSearchTerm('')}>Reset</Button>
|
|
15
|
+
</ToolbarItem>
|
|
16
|
+
)}
|
|
17
|
+
<ToolbarGroup variant="icon-button-group">
|
|
18
|
+
<ToolbarItem>
|
|
19
|
+
<ToggleGroup>
|
|
20
|
+
<ToggleGroupItem icon={<ThIcon />} aria-label="grid icon button" isSelected={layoutView === 'grid'} onChange={() => setLayoutView('grid')}></ToggleGroupItem>
|
|
21
|
+
<ToggleGroupItem icon={<ListIcon />} aria-label="list icon button" isSelected={layoutView === 'list'} onChange={() => setLayoutView('list')}></ToggleGroupItem>
|
|
22
|
+
</ToggleGroup>
|
|
23
|
+
</ToolbarItem>
|
|
24
|
+
</ToolbarGroup>
|
|
25
|
+
<ToolbarItem variant="pagination" spacer={{default: 'spacerMd', md: 'spacerNone'}} style={{'--pf-c-toolbar__item--MinWidth': "max-content"}}>
|
|
26
|
+
<Text component={TextVariants.small}>{ galleryItems.length }{ countText }</Text>
|
|
27
|
+
</ToolbarItem>
|
|
28
|
+
</ToolbarContent>
|
|
29
|
+
</Toolbar>
|
|
30
|
+
);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { groupedRoutes } from '../../routes';
|
|
3
|
+
|
|
4
|
+
export const SectionGalleryWrapper = ({section, subsection, galleryItemsData, illustrations, includeSubsections, parseSubsections, children }) => {
|
|
5
|
+
let sectionRoutes = subsection ? groupedRoutes[section][subsection] : groupedRoutes[section];
|
|
6
|
+
if (!includeSubsections || parseSubsections) {
|
|
7
|
+
const sectionRoutesArr = Object.entries(sectionRoutes);
|
|
8
|
+
// loop through galleryItems object and build new object to handle subsections
|
|
9
|
+
sectionRoutes = sectionRoutesArr.reduce((acc, [navName, routeData]) => {
|
|
10
|
+
// exit immediately if current item is isSubsection flag
|
|
11
|
+
if (navName === 'isSubsection') {
|
|
12
|
+
return acc;
|
|
13
|
+
}
|
|
14
|
+
// add current item
|
|
15
|
+
if (includeSubsections || !routeData.isSubsection) {
|
|
16
|
+
acc[navName] = routeData;
|
|
17
|
+
}
|
|
18
|
+
// drill down into current item if subsection and parseSubsections === true
|
|
19
|
+
if (parseSubsections && routeData.isSubsection) {
|
|
20
|
+
// loop through each subsection item & add
|
|
21
|
+
Object.entries(routeData).map(([subitemName, subitemData]) => {
|
|
22
|
+
if (subitemName !== 'isSubsection') {
|
|
23
|
+
acc[subitemName] = subitemData;
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
return acc;
|
|
28
|
+
}, {})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const [searchTerm, setSearchTerm] = React.useState('');
|
|
32
|
+
const [layoutView, setLayoutView] = React.useState('grid');
|
|
33
|
+
const filteredItems = Object.entries(sectionRoutes)
|
|
34
|
+
.filter(([itemName, { slug }]) => (
|
|
35
|
+
// exclude current gallery page from results
|
|
36
|
+
slug !== location.pathname &&
|
|
37
|
+
itemName
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.includes(searchTerm.toLowerCase())
|
|
40
|
+
));
|
|
41
|
+
const sectionGalleryItems = filteredItems
|
|
42
|
+
.sort(([itemName1], [itemName2]) => itemName1.localeCompare(itemName2))
|
|
43
|
+
.map(([itemName, itemData], idx) => {
|
|
44
|
+
// Convert to lowercase-camelcase ex: File upload - multiple ==> file_upload_multiple
|
|
45
|
+
const illustrationName = itemName
|
|
46
|
+
.replace('-', '')
|
|
47
|
+
.replace(' ',' ')
|
|
48
|
+
.split(' ')
|
|
49
|
+
.join('_')
|
|
50
|
+
.toLowerCase();
|
|
51
|
+
const illustration = illustrations[illustrationName] || illustrations.default_placeholder;
|
|
52
|
+
const { title, id, sources, isSubsection = false } = itemData;
|
|
53
|
+
// Display beta label if tab other than a '-next' tab is marked Beta
|
|
54
|
+
const isBeta = !isSubsection && sources && sources.some(src => src.beta && !src.source.includes('-next'));
|
|
55
|
+
let slug = itemData.slug;
|
|
56
|
+
if (!slug && isSubsection) {
|
|
57
|
+
// Update slug to link to first page in subsection
|
|
58
|
+
const subsectionItems = Object.entries(itemData).filter(([name, _data]) => name !== 'isSubsection');
|
|
59
|
+
const sortedSubsectionItems = subsectionItems.sort((
|
|
60
|
+
[name1, {sortValue: sortValue1 = 50}],
|
|
61
|
+
[name2, {sortValue: sortValue2 = 50}]
|
|
62
|
+
) => {
|
|
63
|
+
if (sortValue1 === sortValue2) {
|
|
64
|
+
return name1.localeCompare(name2);
|
|
65
|
+
}
|
|
66
|
+
return sortValue1 > sortValue2 ? 1 : -1;
|
|
67
|
+
});
|
|
68
|
+
const firstSubsectionItem = sortedSubsectionItems[0];
|
|
69
|
+
slug = firstSubsectionItem[1].slug;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
idx,
|
|
74
|
+
slug,
|
|
75
|
+
itemName,
|
|
76
|
+
illustration,
|
|
77
|
+
isBeta,
|
|
78
|
+
title,
|
|
79
|
+
id,
|
|
80
|
+
galleryItemsData
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className="ws-section-gallery">
|
|
86
|
+
{ children(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) }
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
};
|
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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.30",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"react": "^17.0.0 || ^18.0.0",
|
|
92
92
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "3708bceee20d032325ba4537140a2271fbda5c9c"
|
|
95
95
|
}
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -292,6 +292,7 @@ function sourceMDFile(file, source, buildMode) {
|
|
|
292
292
|
source: pageData.source,
|
|
293
293
|
tabName: pageData.tabName,
|
|
294
294
|
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem }),
|
|
295
|
+
...(pageData.beta && { beta: pageData.beta }),
|
|
295
296
|
...(pageData.sortValue && { sortValue: pageData.sortValue }),
|
|
296
297
|
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
|
|
297
298
|
};
|
|
@@ -149,7 +149,7 @@ module.exports = (_env, argv) => {
|
|
|
149
149
|
'process.env.sideNavItems': JSON.stringify(sideNavItems),
|
|
150
150
|
'process.env.topNavItems': JSON.stringify(topNavItems),
|
|
151
151
|
'process.env.prnum': JSON.stringify(process.env.CIRCLE_PR_NUMBER || process.env.PR_NUMBER || ''),
|
|
152
|
-
'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || '')
|
|
152
|
+
'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || '')
|
|
153
153
|
}),
|
|
154
154
|
new CopyWebpackPlugin({
|
|
155
155
|
patterns: [
|
package/templates/mdx.js
CHANGED
|
@@ -13,7 +13,8 @@ const MDXChildTemplate = ({
|
|
|
13
13
|
Component,
|
|
14
14
|
source,
|
|
15
15
|
toc = [],
|
|
16
|
-
index = 0
|
|
16
|
+
index = 0,
|
|
17
|
+
id
|
|
17
18
|
}) => {
|
|
18
19
|
const {
|
|
19
20
|
propComponents = [],
|
|
@@ -61,6 +62,7 @@ const MDXChildTemplate = ({
|
|
|
61
62
|
)}
|
|
62
63
|
</React.Fragment>
|
|
63
64
|
);
|
|
65
|
+
console.log(id);
|
|
64
66
|
// Create dynamic component for @reach/router
|
|
65
67
|
const ChildComponent = () => (
|
|
66
68
|
<div className="pf-u-display-flex ws-mdx-child-template">
|
|
@@ -68,7 +70,7 @@ const MDXChildTemplate = ({
|
|
|
68
70
|
<TableOfContents items={toc} />
|
|
69
71
|
)}
|
|
70
72
|
<div className="ws-mdx-content">
|
|
71
|
-
<div className="ws-mdx-content-content">
|
|
73
|
+
<div className={id === 'All components' ? "" : "ws-mdx-content-content"}>
|
|
72
74
|
{InlineAlerts}
|
|
73
75
|
<Component />
|
|
74
76
|
{functionDocumentation.length > 0 && (
|
|
@@ -202,6 +204,14 @@ export const MDXTemplate = ({
|
|
|
202
204
|
return "pf-m-light-100";
|
|
203
205
|
};
|
|
204
206
|
|
|
207
|
+
const showTabs = (
|
|
208
|
+
(!isSinglePage && !hideTabName) ||
|
|
209
|
+
isComponent ||
|
|
210
|
+
isUtility ||
|
|
211
|
+
isDemo
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
console.log(id);
|
|
205
215
|
return (
|
|
206
216
|
<React.Fragment>
|
|
207
217
|
<PageGroup>
|
|
@@ -211,38 +221,35 @@ export const MDXTemplate = ({
|
|
|
211
221
|
isWidthLimited
|
|
212
222
|
>
|
|
213
223
|
<TextContent>
|
|
214
|
-
|
|
215
|
-
|
|
224
|
+
<Title headingLevel='h1' size='4xl' id="ws-page-title">{title}</Title>
|
|
225
|
+
{isComponent && summary && (<SummaryComponent />)}
|
|
216
226
|
</TextContent>
|
|
217
227
|
</PageSection>
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
>
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
</ul>
|
|
241
|
-
</div>
|
|
242
|
-
</PageSection>
|
|
228
|
+
{ showTabs && (
|
|
229
|
+
<PageSection id="ws-sticky-nav-tabs" stickyOnBreakpoint={{'default':'top'}} type="tabs">
|
|
230
|
+
<div className="pf-c-tabs pf-m-page-insets pf-m-no-border-bottom">
|
|
231
|
+
<ul className="pf-c-tabs__list">
|
|
232
|
+
{sourceKeys.map((source, index) => (
|
|
233
|
+
<li
|
|
234
|
+
key={source}
|
|
235
|
+
className={css(
|
|
236
|
+
'pf-c-tabs__item',
|
|
237
|
+
activeSource === source && 'pf-m-current'
|
|
238
|
+
)}
|
|
239
|
+
// Send clicked tab name for analytics
|
|
240
|
+
onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
|
|
241
|
+
>
|
|
242
|
+
<Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
|
|
243
|
+
{tabNames[source]}
|
|
244
|
+
</Link>
|
|
245
|
+
</li>
|
|
246
|
+
))}
|
|
247
|
+
</ul>
|
|
248
|
+
</div>
|
|
249
|
+
</PageSection>
|
|
243
250
|
)}
|
|
244
251
|
<PageSection id="main-content" isFilled className="pf-m-light-100">
|
|
245
|
-
{isSinglePage && <MDXChildTemplate {...sources[0]} />}
|
|
252
|
+
{isSinglePage && <MDXChildTemplate {...sources[0]} id={id}/>}
|
|
246
253
|
{!isSinglePage && (
|
|
247
254
|
<Router className="pf-u-h-100" primary={false}>
|
|
248
255
|
{sources
|